From: Gerrit Pape <pape@smarden.org>
To: git@vger.kernel.org
Subject: git-commit: if run with <file> arguments, include files removed through git rm
Date: Tue, 4 Sep 2007 14:43:04 +0000 [thread overview]
Message-ID: <20070904144304.5920.qmail@42e302a26078dc.315fe32.mid.smarden.org> (raw)
If git-commit is given a directory as argument to be included in the
commit, it uses git ls-files to find out which files to include; this
misses files previously removed from the working tree and the index
through git rm:
% git init-db
Initialized empty Git repository in .git/
% mkdir bar baz
% touch bar/file1 baz/file1 baz/file2
% git add . && git commit -mcommit1
Created initial commit 1d7dee4: commit1
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 bar/file1
create mode 100644 baz/file1
create mode 100644 baz/file2
% git rm baz/file1
rm 'baz/file1'
% git commit -- baz/
# On branch master
# Changed but not updated:
# (use "git add/rm <file>..." to update what will be committed)
#
# deleted: baz/file1
#
no changes added to commit (use "git add" and/or "git commit -a")
This patch lets it additionally use git ls-tree to look for the files in
the HEAD tree, but I guess there's a smarter way to fix this.
---
git-commit.sh | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/git-commit.sh b/git-commit.sh
index 1d04f1f..3ac7c4f 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -381,6 +381,7 @@ t,)
fi
TMP_INDEX="$GIT_DIR/tmp-index$$"
commit_only=`git ls-files --error-unmatch -- "$@"` || exit
+ commit_only="$commit_only "`git ls-tree -r --name-only HEAD -- "$@"` || exit
# Build a temporary index and update the real index
# the same way.
--
1.5.3
next reply other threads:[~2007-09-04 14:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-04 14:43 Gerrit Pape [this message]
2007-09-04 16:00 ` git-commit: if run with <file> arguments, include files removed through git rm Junio C Hamano
2007-09-05 10:20 ` Gerrit Pape
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070904144304.5920.qmail@42e302a26078dc.315fe32.mid.smarden.org \
--to=pape@smarden.org \
--cc=git@vger.kernel.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).