Skip to content

Commit

Permalink
documenting gc code generator scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Zalevskiy <denis.zalevskiy@jolla.com>
  • Loading branch information
Denis Zalevskiy committed Oct 28, 2014
1 parent 2b16a79 commit fab6826
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tools/git-vault-gc.sh
Expand Up @@ -112,7 +112,7 @@ echo "REPLACE MASTER"
git branch -D old-master) || error "replacing master"

echo "CLEAR REFLOG"
git reflog expire --expire=now --all || error "exiring reflog"
git reflog expire --expire=now --all || error "clearing reflog"

echo "REMOVING DANGLING BLOBS"
for obj in $(git fsck --unreachable master \
Expand Down
1 change: 1 addition & 0 deletions tools/git-vault-rebase-generate.awk
@@ -1,5 +1,6 @@
BEGIN {
ok=0
# prepare empty arrays
split("", commits);
split("", commands);
split("", old_tags);
Expand Down
12 changes: 11 additions & 1 deletion tools/git-vault-rebase-prepare.awk
@@ -1,13 +1,16 @@
BEGIN {
# expects the list of git log entries in the format %H$%d$%s
# so fields are [hash, csv of refs, subject]
FS="$";
split("", commands);
date_tag_re = /^[0-9]+-[0-9]+-[0-9]+T[0-9]+-[0-9]+-.*/;
}

# skipping unit add/remove commit - deprecated
$2 == "" && substr($3, 1, 1) ~ "[+-]" {
print "skip", $1
}

# unit backup commit
$2 == "" && substr($3, 1, 1) == ">" {
print "add", $1, $3;
}
Expand All @@ -16,26 +19,33 @@ $2 != "" && $3 !~ date_tag_re && $3 != "anchor" {
print "copy", $1
}

# backup tag commit subject starts with the iso date
$2 != "" && $3 ~ date_tag_re {
split($2, refs, ",");
is_found=0
for (i in refs) {
# backup tag is '>' + transformed iso date
if (match(refs[i], /[(]?tag: (>.+Z)[)]?/, found) != 0) {
tag=found[1];
print "tag", $1, tag
is_found=1
break
}
}
# tag was removed, so this backup commit should be
# squashed/removed. Unit commits will be squashed with the
# following ones (if any) or removed
if (!is_found) {
print "old_tag", $1
}
}

# branch should be grown starting from the anchor
$3 == "anchor" {
print "start", $1
}

# some commit w/o any refs - for the vault this is removed backup
$2 == "" && $3 ~ date_tag_re {
print "old_tag", $1
}

0 comments on commit fab6826

Please sign in to comment.