Branch: Tag:


2011-01-13 11:02:08 by Marcus Comstedt <>

Check that pushes preserve first-parent ancestry

In addition to checking that a push is fast-forward, make sure
that the old head can be reached through first-parent pointers only.
This prevents tracking branches which have been pulled with merge
instead of rebase from being pushed by mistake.

565:    write("Push to %s is not fast-forward.\n", ref_name);    return 1;    } +  array(string) fp_path = split_lf(run_git("rev-list", "--first-parent", +  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; +  }       commits_to_check += split_lf(run_git("rev-list", old_sha+".."+new_sha));    return 0;