[BUG] git add -u ignores --dry-run flag
From: Gustaf Hendeby <hidden>
Date: 2016-06-15 22:44:37
Hi! I think this is a bug in the built in implementation of git add -u $ git --version git version 1.5.5.1.373.ga3200 $ git init Initialized empty Git repository in /home/hendeby/bar/.git/ $ echo foo > foo $ git add foo && git commit -m "Test" Created initial commit 7477e8b: Test 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 foo $ echo foo >> foo $ git add -u --dry-run $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: foo # I was expecting to get foo listed, and not actually added to the index. I've had a quick look in builtin-add.c, and the -u option is tested for before the --dry-run option, and in the process of handling the -u option the code makes a jump that bypasses the --dry-run handling. Unfortunately, I'm not familiar enough with the code to see how to best fix it. /Gustaf