git log - Why isn't the pathspec magic :(exclude) excluding the specified files from git log's output? -


this follow-up ignore files in git log -p , related making 'git log' ignore changes paths.

i'm using git 1.9.2. i'm trying use pathspec magic :(exclude) specify patches should not shown in output of git log -p. however, patches want exclude still show in output.

here minimal working example reproduces situation:

$ cd ~/desktop $ mkdir test_exclude $ cd test_exclude $ git init $ mkdir testdir $ printf "my first cpp file\n" > testdir/test1.cpp $ printf "my first xml file\n" > testdir/test2.xml $ git add testdir/ $ git commit -m "added 2 test files" 

now want show patches in history expect corresponding xml files in testdir folder. therefore, following vonc's answer, run

$ git log --patch -- . ":(exclude)testdir/*.xml" 

but patch testdir/test2.xml file still shows in output:

commit 37767da1ad4ad5a5c902dfa0c9b95351e8a3b0d9 author: xxxxxxxxxxxxxxxxxxxxxxxxx date:   mon aug 18 12:23:56 2014 +0100      added 2 test files  diff --git a/testdir/test1.cpp b/testdir/test1.cpp new file mode 100644 index 0000000..3a721aa --- /dev/null +++ b/testdir/test1.cpp @@ -0,0 +1 @@ +my first cpp file diff --git a/testdir/test2.xml b/testdir/test2.xml new file mode 100644 index 0000000..8b7ce86 --- /dev/null +++ b/testdir/test2.xml @@ -0,0 +1 @@ +my first xml file 

what doing wrong? should tell git log -p not show patch associated xml files in testdir folder?

nevermind. problem appears have been fixed in git 1.9.5 (more specifically, in commit ed22b4173bd8d6dbce6236480bd30a63dd54834e). toy example in question above works expected in git 2.2.1:

$ git --version git version 2.2.1 $ mkdir test_exclude $ cd test_exclude/ $ git init initialized empty git repository in /users/jubobs/desktop/test_exclude/.git/ $ mkdir testdir $ printf "my first cpp file\n" > testdir/test1.cpp $ printf "my first xml file\n" > testdir/test2.xml $ git add testdir/ $ git commit -m "added 2 test files" [master (root-commit) 5429d04] added 2 test files  2 files changed, 2 insertions(+)  create mode 100644 testdir/test1.cpp  create mode 100644 testdir/test2.xml  $ git log --patch -- . ":(exclude)testdir/*.xml" commit 5429d047f140f96c5d6167d083fc1a5eab05fb19 author: xxxxxxxxxxxxxxxxxxxxxxxxx date:   fri dec 26 23:40:18 2014 +0100      added 2 test files  diff --git a/testdir/test1.cpp b/testdir/test1.cpp new file mode 100644 index 0000000..3a721aa --- /dev/null +++ b/testdir/test1.cpp @@ -0,0 +1 @@ +my first cpp file 

as can see, there no mention of test2.xml in output of git log command, desired.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -