{"thread":{"id":"24606","subject":"[PATCH] Fix git svn dcommit to work with touched files","startedAt":"2010-08-02T19:58:19Z","lastAt":"2010-08-02T22:20:17Z","messageCount":2,"participants":["David D. Kilzer","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"146979","messageId":"1280779099-29742-1-git-send-email-ddkilzer@kilzer.net","threadId":"24606","inReplyTo":null,"subject":"[PATCH] Fix git svn dcommit to work with touched files","fromName":"David D. Kilzer","fromEmail":"ddkilzer@kilzer.net","sentAt":"2010-08-02T19:58:19Z","receivedAt":"2010-08-02T19:58:19Z","isPatch":true,"sender":{"key":"ddkilzer@kilzer.net","avatar":"https://avatars.githubusercontent.com/u/263571?v=4"},"body":"The dcommit command fails if an otherwise unmodified file has\nbeen touched in the working directory:\n\n    Cannot dcommit with a dirty index.  Commit your changes\n    first, or stash them with `git stash'.\n\nThis happens because \"git diff-index\" reports a difference\nbetween the index and the filesystem:\n\n    :100644 100644 d00491...... 000000...... M      file\n\nThe fix is to run \"git update-index --refresh\" before\n\"git diff-index\" as is done in git-rebase and\ngit-rebase--interactive before \"git diff-files\".\n\nThis changes dcommit to display a list of modified files before\nexiting.\n\nAlso add a similar test case for \"git svn rebase\".\n\nSigned-off-by: David D. Kilzer <ddkilzer@kilzer.net>\n---\n git-svn.perl             |    1 +\n t/t9100-git-svn-basic.sh |   11 +++++++++++\n 2 files changed, 12 insertions(+), 0 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex c416358..b8a98d4 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -494,6 +494,7 @@ sub cmd_set_tree {\n \n sub cmd_dcommit {\n \tmy $head = shift;\n+\tcommand_noisy(qw/update-index --refresh/);\n \tgit_cmd_try { command_oneline(qw/diff-index --quiet HEAD/) }\n \t\t'Cannot dcommit with a dirty index.  Commit your changes first, '\n \t\t. \"or stash them with `git stash'.\\n\";\ndiff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh\nindex 13766ab..d5adae6 100755\n--- a/t/t9100-git-svn-basic.sh\n+++ b/t/t9100-git-svn-basic.sh\n@@ -271,6 +271,17 @@ test_expect_success 'able to dcommit to a subdirectory' \"\n \ttest -z \\\"\\`git diff refs/heads/my-bar refs/remotes/bar\\`\\\"\n \t\"\n \n+test_expect_success 'dcommit should not fail with a touched file' '\n+\ttest_commit \"commit-new-file-foo2\" foo2 &&\n+\ttest-chmtime =-60 foo &&\n+\tgit svn dcommit\n+'\n+\n+test_expect_success 'rebase should not fail with a touched file' '\n+\ttest-chmtime =-60 foo &&\n+\tgit svn rebase\n+'\n+\n test_expect_success 'able to set-tree to a subdirectory' \"\n \techo cba > d &&\n \tgit update-index d &&\n-- \n1.7.2.1.9.g74fb9\n"},{"id":"147007","messageId":"20100802222017.GA654@dcvr.yhbt.net","threadId":"24606","inReplyTo":"1280779099-29742-1-git-send-email-ddkilzer@kilzer.net","subject":"Re: [PATCH] Fix git svn dcommit to work with touched files","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2010-08-02T22:20:17Z","receivedAt":"2010-08-02T22:20:17Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"\"David D. Kilzer\" <ddkilzer@kilzer.net> wrote:\n> The dcommit command fails if an otherwise unmodified file has\n> been touched in the working directory:\n\n> Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>\n\nThanks David,\n\nI've rearranged your commit subject slightly.\n\nAcked-by: Eric Wong <normalperson@yhbt.net>\n\n... And pushed out to git://git.bogomips.org/git-svn\n\n  David D. Kilzer (1):\n        git svn: fix dcommit to work with touched files\n\n  Dmitry Statyvka (1):\n        git svn: add an option to recode pathnames\n\n-- \nEric Wong\n"}]}