Branch: Tag:


2013-01-23 20:18:30 by Marcus Comstedt <>

Add a kluge to handle pushes to branches with exactly one commit

When pushing to a branch, githelper checks if the old head of the
branch is reachable from the new head following only first-parents.
As an optimization, no more first-parents are followed once the old
head has been reached, which is to say old^ and its ancestors are
excluded from the rev-list. However, if old does not have a parent,
then rev-list fails to interpret old^. So as a kluge, detect this
case and disable the optimization as needed...

615:    write("Push to %s is not fast-forward.\n", ref_name);    return 1;    } +  array(string) old_depth = split_lf(run_git("rev-list", "--first-parent", +  "-n", "2", old_sha));    array(string) fp_path = split_lf(run_git("rev-list", "--first-parent", -  old_sha+"^.."+new_sha)); +  (sizeof(old_depth)<2? +  new_sha : +  old_sha+"^.."+new_sha)));    if (search(fp_path, old_sha)<0) {    write("Commit %s does not contain %s in its first-parent ancestry.\nDid you pull with merge instead of rebase?\n", new_sha, old_sha);    return 1;