summaryrefslogtreecommitdiffstats
path: root/src/VREF/NAME_NC
blob: 1a8171450adfd570b520bc31c4c7845413684508 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh

# ----------------------------------------------------------------------
# VREF/NAME_NC
#   Like VREF/NAME, but only considers "new commits" -- i.e., commits that
#   don't already exist in the repo as part of some other ref.

# ----------------------------------------------------------------------
# WHY
#   VREF/NAME doesn't deal well with tag creation (or new branch creation),
#   since then all files in the project look like they are being created (due
#   to comparison with an empty tree).

#   Use this instead of VREF/NAME when you need to make that distinction.

newsha=$3

[ $newsha = "0000000000000000000000000000000000000000" ] && {
    echo "we don't currently handle deletions" >&2
    exit 1
}

git log --name-only --format=%n $newsha --not --all |
    sort -u | grep . | sed -e 's.^.VREF/NAME_NC/.'

# ----------------------------------------------------------------------
# OTHER NOTES
#   The built-in NAME does have a wee bit of a performance advantage.  I plan
#   to ignore this until someone notices this enough to be a problem :)
#
#   I could explain it here at least, but I fear that any explanation will
#   only add to the already rampant confusion about how VREFs work.  I'm not
#   rocking THAT boat again, sorry!