From: Geoffrey Irving <irving@naml.us>
To: git@vger.kernel.org, Lars Hjemli <hjemli@gmail.com>
Subject: bug with .git file and aliases
Date: Mon, 20 Jul 2009 09:54:12 -0400 [thread overview]
Message-ID: <7f9d599f0907200654q2e068e6aq3051c122f6596053@mail.gmail.com> (raw)
git 1.6.3.3 has a bug related to .git file support and aliases.
Specifically, if you make an alias for status and call it from a
subdirectory, git status chdirs into the true .git dir but then
chdir's back to the wrong place in order to run the lstats for status.
The result is that git status thinks all files have disappeared.
Here's a self-contained test script:
#!/bin/bash
set -x
# make a simple repository
mkdir repo
cd repo
git init
mkdir a
echo content > a/b
git add a/b
git commit -m "a commit"
# replace the gitdir with a gitfile
mv .git ../repo.git
echo gitdir: `pwd`.git > .git
# normal git status works
cd a
git status
# an alias for git status fails
git config alias.st status
git st
which produces output
top:tmp% ./bug
++ mkdir repo
++ cd repo
++ git init
Initialized empty Git repository in /Users/irving/tmp/tmp/repo/.git/
++ mkdir a
++ echo content
++ git add a/b
++ git commit -m 'a commit'
[master (root-commit) 6b07ec4] a commit
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 a/b
++ mv .git ../repo.git
+++ pwd
++ echo gitdir: /Users/irving/tmp/tmp/repo.git
++ cd a
++ git status
# On branch master
nothing to commit (working directory clean)
++ git config alias.st status
++ git st
# On branch master
# Changed but not updated:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: a/b
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# b
no changes added to commit (use "git add" and/or "git commit -a")
.git file support also doesn't work on a repository with no commits
(which is why the test script makes a commit normally before switching
to a gitfile). However, I care about this second problem much less,
and didn't notice it until I made the test script.
Finally, huge thanks to Lars for implementing this. I'm storing git
working directories inside vesta, and symlink support is currently
disabled. It's very pleasant to grep through the source and find that
someone already fixed exactly my problem. :)
Geoffrey
next reply other threads:[~2009-07-20 13:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-20 13:54 Geoffrey Irving [this message]
2009-07-20 14:04 ` bug with .git file and aliases Santi Béjar
2009-07-20 14:27 ` Geoffrey Irving
2009-07-20 15:18 ` Santi Béjar
2009-07-20 15:25 ` Geoffrey Irving
2009-07-20 15:21 ` Jeff King
2009-08-10 20:22 ` Geoffrey Irving
2009-08-10 23:05 ` Johannes Schindelin
2009-08-11 3:37 ` Geoffrey Irving
2009-08-11 8:33 ` Johannes Schindelin
2009-08-11 10:04 ` Michael J Gruber
2009-08-11 10:26 ` Johannes Sixt
2009-08-11 10:37 ` Michael J Gruber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7f9d599f0907200654q2e068e6aq3051c122f6596053@mail.gmail.com \
--to=irving@naml.us \
--cc=git@vger.kernel.org \
--cc=hjemli@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).