0

I am trying to list commits from a branch that do not touch a certain directory, following the advice in Making 'git log' ignore changes for certain paths:

git rev-list heads/demo ^master -- . ':(exclude)demo'

(Note that demo is both the name of the branch and of the folder to exclude.)

The result contains all the commits that touch other paths and only excludes those that only touch files in the demo/ directory. What I would like to see instead are only those commits that do not touch any file in the demo/ directory. To clarify:

cc3ecaa define a task for creating the demo app
M   .gitignore
M   Gruntfile.js
A   demo/compile
A   tasks/demo.js

currently is included because it contains files outside demo/, but I would like it to be excluded because it contains files inside demo/.

ccprog
  • 20,308
  • 4
  • 27
  • 44

1 Answers1

0
awk ' !seen[$1]++ && NR!=FNR ' \
    <(git rev-list master..heads/demo -- demo/) \
    <(git rev-list master..heads/demo)

or

awk ' !NF{ printit=1 } !seen[$1]++ && printit' <<EOD
$(git rev-list master..heads/demo -- demo/)

$(git rev-list master..heads/demo)
EOD  

or

( git rev-list master..heads/demo -- demo/ 
  echo
  git rev-list master..heads/demo ) \
| awk '!NF { ++printit } seen[$1]++ && printit'
jthill
  • 55,082
  • 5
  • 77
  • 137
  • I feared that I had to go via awk, but to figure it out for myself would have taken me several hours, so a heartfelt thanks. – ccprog Dec 30 '17 at 20:44