Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1488133
Summary: | Local git aliases don't work in linked working tree | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Jonathan Wakely <jwakely> | ||||
Component: | git | Assignee: | Petr Stodulka <pstodulk> | ||||
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | unspecified | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | 26 | CC: | amahdal, besser82, c.david86, chrisw, jbowes, pstodulk, tmz | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | git-2.13.5-2.fc26 | Doc Type: | If docs needed, set a value | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2017-09-08 16:21:50 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Jonathan Wakely
2017-09-04 12:11:31 UTC
(In reply to Jonathan Wakely from comment #0) > Steps to Reproduce: I missed the first lines out, which should have been: cd /tmp mkdir git > tmp$ cd git > git$ mkdir primary > git$ cd primary > primary$ git init > Initialized empty Git repository in /tmp/git/primary/.git/ > master primary$ git config alias.l log > master primary$ git l > fatal: your current branch 'master' does not have any commits yet > master primary$ touch file > master% primary$ git add file > master+ primary$ git ci -m begin Sorry, "ci" is a (global) alias on my machine. That should have been "commit". (In reply to Jonathan Wakely from comment #0) > Description of problem: > > Git aliases defined in the .git/config file (i.e. --local ones) do not work > in a linked working tree. > > This is a regression from F24. It worked correctly with > git-2.7.5-1.fc24.x86_64 and I'm told it works correctly with 2.14.1 so > please see if the fix can be backported. It works correctly in F25 with git-2.9.5-1.fc25.x86_64 It works correctly in rawhide with git-2.14.1-2.fc27.x86_64.rpm Only F26 doesn't work. Fixed upstream by: commit f31d23a399d557d687266b4375a0436f920cc051 (HEAD) Merge: 5812b3f73 dc8441fdb Author: Junio C Hamano <gitster> Date: Sat Jun 24 14:28:40 2017 -0700 Merge branch 'bw/config-h' Fix configuration codepath to pay proper attention to commondir that is used in multi-worktree situation, and isolate config API into its own header file. * bw/config-h: config: don't implicitly use gitdir or commondir config: respect commondir setup: teach discover_git_directory to respect the commondir config: don't include config.h by default config: remove git_config_iter config: create config.h The bug was introduced by: commit a9bcf6586d1a4888aea91553d73cda20494b8335 (HEAD) Author: Johannes Schindelin <johannes.schindelin> Date: Wed Jun 14 13:36:00 2017 +0200 alias: use the early config machinery to expand aliases Instead of discovering the .git/ directory, reading the config and then trying to painstakingly reset all the global state if we did not find a matching alias, let's use the early config machinery instead. It may look like unnecessary work to discover the .git/ directory in the early config machinery and then call setup_git_directory_gently() in the case of a shell alias, repeating the very same discovery *again*. However, we have to do this as the early config machinery takes pains *not* to touch any global state, while shell aliases expect a possibly changed working directory and at least the GIT_PREFIX and GIT_DIR variables to be set. This change also fixes a known issue where Git tried to read the pager config from an incorrect path in a subdirectory of a Git worktree if an alias expanded to a shell command. Signed-off-by: Johannes Schindelin <johannes.schindelin> Reviewed-by: Jeff King <peff> Signed-off-by: Junio C Hamano <gitster> Thanks Jonathan for report and investigation. I am going to test this and create new build. Created attachment 1321880 [details]
Backport of upstream fix to 2.13.5
This patch is a smaller version of the upstream fix, just adding the commondir field to struct config_options, and populating it appropriately. The changes to create a new config.h header and move function prototypes to it (and rename some functions) are not included here, as those are just refactoring and don't change any functionality.
However a new f26 RPM containing the patch fails to build:
*** t0012-help.sh ***
ok 1 - setup
not ok 2 - works for commands and guides by default
#
# configure_help &&
# git help status &&
# echo "test://html/git-status.html" >expect &&
# test_cmp expect test-browser.log &&
# git help revisions &&
# echo "test://html/gitrevisions.html" >expect &&
# test_cmp expect test-browser.log
#
ok 3 - --exclude-guides does not work for guides
ok 4 - --help does not work for guides
# failed 1 among 4 test(s)
1..4
make[2]: *** [Makefile:49: t0012-help.sh] Error 1
make[2]: Leaving directory '/builddir/build/BUILD/git-2.13.5/t'
make[1]: Leaving directory '/builddir/build/BUILD/git-2.13.5/t'
make[1]: *** [Makefile:36: test] Error 2
make: *** [Makefile:2322: test] Error 2
It fails because the test-browser.log doesn't exists: $ sh t0012-help.sh -v <snip> diff: test-browser.log: No such file or directory not ok 2 - works for commands and guides by default <snip> but still do not know exactly what is source of troubles. I found that there are more tests that failed now, so I will do better investigation now. Additional info: The patch in attachment works on upstream branch correctly after the 4b44b7b1d commit (with small updates for setup.c). However it doesn't contain complete fix for Git v2.13.5 yet. My big mistake. Whole problem solves a560d87033729. The problem was about the git_common_dir, that was not initialized. My mistake as I probably did testing wrongly for the first time when I tried that, so I waste time by looking for solution elsewhere. git-2.13.5-2.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-5aa2567cee git-2.13.5-2.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-5aa2567cee git-2.13.5-2.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report. |