1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-01 21:51:40 +02:00
Commit graph

175 commits

Author SHA1 Message Date
Daniel Shahaf
510df60dd1 51144, 51146: vcs_info git: stg: Extract patch descriptions
Joint work with Peter Grayson.
2022-12-09 01:39:32 +00:00
Daniel Shahaf
7cdada166c 51142: vcs_info git: Check the get-unapplied style as documented
The style was treated as "always true" rather than as "settable, false
by default" in the rebase-merge and cherry-pick cases.  This affects the
gen-unapplied-string hook, and may also affect gen-applied-string and
set-patch-format hooks if they accessed VCS_INFO_get_data_git's internal
parameters directly.

If this affects you, just set the style in your zshrc:
.
    zstyle ':vcs_info:git*:*:*' get-unapplied true
2022-12-08 22:09:59 +00:00
Peter Grayson
ca7c42e1ee 51138: Updated StGit patch detection in vcs_info
The vcs_info patch detection code attempted to interrogate StGit patch
stack state by inspecting .git/patches/applied and
.git/patches/unapplied.

As of StGit 0.15 (2009), patch stack metadata is captured in the repo's
object database. And as of StGit 1.0 (2021), no stack or patch state is
maintained in any files in the .git/ directory.

Zsh's approach for interrogating StGit patch state is thus obsoleted.

This patch updates vcs_info to determine whether StGit is initialized on a
branch by looking at the appropriate git refs and uses StGit's prescribed
interface for interrogating applied and unapplied patch state via the `stg
series` command. This approach will work with all versions of StGit >=0.15.

Signed-off-by: Peter Grayson <pete@jpgrayson.net>
2022-12-08 21:27:35 +00:00
Daniel Shahaf
421f5d7f67 49728: vcs_info hg mq: Don't include applied patches in the unapplied patches
For instance, with 4 applied patches, 5 unapplied patches, and no guards
involved, the patch-format style would indicate 9 (= 4+5) unapplied patches
and 4 applied patches.
2022-02-20 10:16:54 +00:00
Daniel Shahaf
80389df480 49727 (+ comment): vcs_info quilt: Pass the patches dir path to the gen-applied-string, gen-unapplied-string, and set-patch-format hooks
I use that in my gen-applied-string hook.
2022-02-20 10:16:33 +00:00
Daniel Shahaf
b8b7d9b46a unposted: vcs_info hg mg (with get-unapplied set): Stop leaking a variable to global scope 2022-02-20 10:12:56 +00:00
Marc Cornellà
2b66ed35b0 security/82: VCS_Info: Fix typo in hook_com[base-name_orig] assignment
Tweaked per discussion in security/90, security/91

(cherry picked from commit b34d33e3b3)
2022-02-12 10:29:55 -06:00
Daniel Shahaf
75c3664a62 unposted: vcs_info git: Teach the rebase-apply test case generator to also generate rebase-merge test cases 2022-01-29 16:01:39 +00:00
Daniel Shahaf
10ee9e5bd7 unposted: vcs_info git: Add a missing guard against redefining a function. 2022-01-29 16:01:39 +00:00
Daniel Shahaf
42f1e99f81 unposted: vcs_info git: Deconfuse $EDITOR
Work around <https://github.com/chrisbra/vim-zsh/issues/39>.
2022-01-29 16:01:39 +00:00
Daniel Shahaf
c055c6464d unposted: vcs_info: Add Vim modelines
... for consistency with all other vcs_info function files.
2022-01-29 16:01:39 +00:00
Daniel Shahaf
ee5e3d0c9d 49723: vcs_info quilt: Use quilt-patch-dir and ${QUILT_PATCHES} even when get-unapplied hasn't been set
This affects the post-quilt hook.  Before this patch, if no patches have
been applied and get-unapplied hasn't been set, the second argument to
that hook would undergo null elision.

The generation of patch subjects for the gen-applied-string,
gen-unapplied-string, and set-patch-format hooks was unaffected since
it was guarded by [[ -n $patches ]].
2022-01-29 11:04:44 +00:00
Daniel Shahaf
e52062170a 49722: vcs_info quilt: Refactor for readability. No functional change. 2022-01-29 11:04:43 +00:00
Daniel Shahaf
b99599b4f4 unposted: vcs_info quilt: Remove a no-op variable assignment 2022-01-27 17:34:57 +00:00
Daniel Shahaf
8460d75869 49709: vcs_info hg: Keep $HGPLAIN set for hooks if it had been set outside vcs_info
If someone does 'HGPLAIN=1 vcs_info', any vcs_info hooks should be called with
HGPLAIN set.  Declaring it 'local' broke that.
2022-01-25 10:11:58 +00:00
Daniel Shahaf
9353b12e99 users/26635 (tweaked): vcs_info hg: Compute the branch name correctly when get-revision is set and check-for-changes is not
Tweak: Simplify an always-true condition.

Review-by: Manuel Jacob
2021-04-21 00:57:59 +00:00
Aleksandr Mezin
fc82e8193b 47561 (the git and cvs parts) (compare 44919 + 44920): vcs_info internals: cvs, git: Set ${vcs_comm[basedir]} like all other backends do.
That doesn't affect anything, not even other vcs_info internals; it's
just for consistency across backends.
2021-03-29 17:03:40 +00:00
Daniel Shahaf
5448e1611d 47303: vcs_info hg: Fix changing the expansion of %g (hook_com[guards]) in the set-patch-format hook (regression from workers/40480).
To reproduce, go to a hg repository with active mq guards and configure
vcs_info as follows:

    zstyle '*' get-unapplied true
    zstyle ':vcs_info:*set-patch-format*' hooks f
    zstyle '*' patch-format '[%g : %G]'
    zstyle '*' nopatch-format '[%g : %G]'
    zstyle '*' formats '%m'
    +vi-f () {
    	hook_com[guards]+=XXX
    }

The regression was first released in 5.3.1-test-2, over three years ago.
2020-08-09 08:07:01 +00:00
Manuel Jacob
ae0129b49f 46091: Add code to Mercurial VCS backend to show topic if there is any.
"Topics" is an experimental concept in Mercurial that augments the
current branching concept (called "named branches").

For more information, see the not always up-to-date Mercurial Wiki page
https://www.mercurial-scm.org/wiki/TopicPlan.
2020-06-22 08:18:38 +00:00
Daniel Shahaf
2f2aa360bc 45644: vcs_info git: Fix current patch's name in several cases. 2020-03-28 22:12:33 +00:00
Daniel Shahaf
d13d6afb2e 45627: vcs_info git: Under git-am(1) conflicts, pass to the gen-applied-string hook information on already-applied patches.
The hook already receives information about the current (topmost
applied) patch and, if the get-unapplied style is set, about future
(unapplied) patches.

Tested in the Functions/VCS_Info/test-repo-git-rebase-apply scenario,
after manually converting the rebase to a «git am».  (Specifically,
I ran:
    mkdir d
    git rebase --abort
    git format-patch rebase_from_this..HEAD -o d
    git checkout rebase_onto_this
    git am d/*
.)
2020-03-27 01:14:42 +00:00
Daniel Shahaf
f207fb90d8 45625: vcs_info svn: Detect the "working copy format is too new" error. 2020-03-27 01:14:42 +00:00
Daniel Shahaf
cb87816b0f 45626: vcs_info: Deduplicate calling the set-branch-format hook. 2020-03-27 01:14:42 +00:00
Daniel Shahaf
b0d020408a 45624: vcs_info: Set $rrn in all backends. 2020-03-27 01:14:42 +00:00
Daniel Shahaf
e5765bfdc8 45541: internal: vcs_info git: Add a test case repository for rebase-apply situations 2020-03-15 00:18:31 +00:00
Daniel Shahaf
4ce4483daf 45539: vcs_info git: In non-interactive rebases, obtain applied patches' names. 2020-03-15 00:18:30 +00:00
Daniel Shahaf
e1946bacf8 45540: vcs_info git: In non-interactive rebases, compute patch names for unapplied patches. 2020-03-15 00:18:28 +00:00
Daniel Shahaf
5a1f5cf8ab 45543: vcs_info quilt: Allow quiltcommand to be a function.
Before this commit, it could only be an external command.
2020-03-15 00:18:27 +00:00
Daniel Shahaf
8e128afb2c 45547: vcs_info git: In interactive rebases, process gen-unapplied-string arguments like gen-applied-string arguments are processed.
I consider this a bugfix, since it's unexpected for -applied and
-unapplied to differ about this.
2020-03-15 00:18:25 +00:00
Daniel Shahaf
c756545014 45546: vcs_info git: In interactive rebases, properly support the full form of the "exec" verb.
The code before this commit happened to have done the right thing:
"exec" lines were handled by the catchall forward compatibility case,
which happened to have had virtually the same effect as the correct
case.  However, that was merely an accidental result.  This patch makes
the code do the right thing deliberately, rather than by accident.
2020-03-15 00:18:23 +00:00
Daniel Shahaf
af57462beb 45545: vcs_info git: In interactive rebases, ignore comment lines. 2020-03-15 00:18:21 +00:00
brian m. carlson
5126096370 github #48/0002: vcs_info git: properly detect bare repositories
We currently detect Git repositories by finding the top level of the
working tree, and if we fail to detect it, assume that we're not in a
repository.  However, there's a case we don't consider: a bare
repository.

Let's detect if the user is in a bare repository by checking if gitdir
is set, and if so, using that if there is no working tree.  We now
detect bare Git repositories with vcs_info, as expected.
2020-02-17 10:03:08 +00:00
brian m. carlson
bacad96523 github #48/0001: vcs_info git: avoid warnings in bare repositories
Git 2.25 introduced a change to how git rev-parse --show-toplevel
behaves.  Traditionally, it succeeded with no output if the user was
in a bare repository.  Now it dies, printing an error to standard error.
Consequently, when the user is in a bare repository with a newer Git,
vcs_info prints noisily to standard error.

While this is functionally harmless, it is annoying for the shell to
print messages from Git every time the prompt is printed, so let's
silence the error message.
2020-02-17 10:02:27 +00:00
Daniel Shahaf
86db36ab70 45114: vcs_info quilt: Improve support for svn-style patch headers.
Additional lines between the |-separated header line and the actual
log message, as generated by 'svn log -v' and 'svn log -g', are now
supported.

This change affects you if you have quilt patches with 'svn log'-style
information in their headers, regardless of whether you use quilt
standalone, quilt over svn, or quilt over some other VCS.
2019-12-22 03:21:03 +00:00
Daniel Shahaf
61262ae282 44960: vcs_info cvs: Fix infinite loop when /CVS exists. 2019-12-03 03:03:05 +00:00
Daniel Shahaf
9e771a0b20 44961: vcs_info svn: Fix infinite loop when /.svn exists. 2019-12-03 02:56:02 +00:00
Daniel Shahaf
ce950dd4b4 44962: vcs_info: Document internal function and variable 2019-12-03 02:56:01 +00:00
Daniel Shahaf
98f8a8a980 44958: vcs_info quilt: Avoid forks 2019-11-29 20:57:01 +00:00
Daniel Shahaf
cc3983ee58 44945: vcs_info git: Optimize detection by running fewer external commands. 2019-11-29 20:56:42 +00:00
dana
b70919e0d9 44020: VCS_INFO_detect_p4: Fix infinite recursion 2019-01-27 00:26:31 -06:00
Daniel Shahaf
23154e46e6 43879: vcs_info git: Fix fatal error in VCS_INFO_git_getbranch in corner case
Before this commit, the following use-case:

    git checkout foo^
    git show foo | git am

would result in a fatal error, with vcs_info_msg_N_ not set:

    VCS_INFO_git_getbranch:18: no such file or directory: .git/rebase-apply/onto

Now they are set correctly, and HEAD's commit hash is used.
2018-12-13 15:28:00 +00:00
Daniel Shahaf
e38f15f8ff 43620 (tweaked): vcs_info git: Reverse the order patches are passed to gen-unapplied-string in.
This is an incompatible change; see README for details.

Tweaks (relative to posted version): tweaked README, removed scalpel (debug print).
2018-10-08 13:44:40 +00:00
Daniel Shahaf
31dcba76f0 43617: vcs_info git: During a non-interactive rebase of a detached head, computer the %b expando correctly.
Before this commit, the value of %b was the hash of the commit from the
"source" side of the rebase, from .git/rebase-apply/orig-head and
.git/rebase-apply/original-commit.  This broke the invariant that
%b expands to a git-rev-parse(1) expression resolving to what %r
expands to.

Use .git/rebase-apply/onto instead as, empirically, it contains the
correct value.
2018-10-08 13:41:45 +00:00
Daniel Shahaf
0e0219118d 43619: vcs_info git: In non-interactive rebases, always set $hook_com[git_patches_applied] to a string of the form 'foo bar', never just 'foo'. 2018-10-08 13:41:43 +00:00
Daniel Shahaf
a05533e425 43618: vcs_info: Don't redefine helper functions on every execution of the autoloadable outer function.
This allows enabling tracing of the helper functions without fned'ing
the outer function.
2018-10-08 13:41:41 +00:00
Daniel Shahaf
5c9ef1a1fa 43587: vcs_info git: In 'git rebase -i', when computing subjects of applied-patches, handle an edge case where the subject is not available. 2018-10-07 15:05:19 +00:00
Daniel Shahaf
0c00eed4c7 43588: vcs_info git: Make sure applied-patches is of the form "$hash $subject" --- that is, has a space and a non-empty second argument --- even with future 'git rebase -i' verbs.
Use of '?' is consistent with these precedents:

Backends/VCS_INFO_get_data_git:220:            printf -v "git_patches_applied[$p]"  "%04d ?" "$p"
Backends/VCS_INFO_get_data_git:242:                git_patches_applied+=("? $subject")
Backends/VCS_INFO_get_data_git:244:                git_patches_applied+=("?")
VCS_INFO_quilt:160:            applied[$i]+=" ?"
VCS_INFO_quilt:168:            unapplied[$i]+=" ?"
2018-10-07 15:05:17 +00:00
Daniel Shahaf
a27fad1ae2 43586: vcs_info git: Reformat to minimise next diff. No functional change. 2018-10-07 15:05:15 +00:00
Daniel Shahaf
abc94e8f6a 43585: vcs_info svn: Recognize working copies in need of an upgrade. 2018-10-07 15:05:13 +00:00
Daniel Shahaf
f9952301b2 unposted: Indicate which use-case each branch handles. 2018-10-02 15:22:06 +00:00