Code

Merge branch 'master' into lj/refs
authorJunio C Hamano <junkio@cox.net>
Thu, 28 Sep 2006 05:23:12 +0000 (22:23 -0700)
committerJunio C Hamano <junkio@cox.net>
Thu, 28 Sep 2006 05:23:12 +0000 (22:23 -0700)
* master: (72 commits)
  runstatus: do not recurse into subdirectories if not needed
  grep: fix --fixed-strings combined with expression.
  grep: free expressions and patterns when done.
  Corrected copy-and-paste thinko in ignore executable bit test case.
  An illustration of rev-list --parents --pretty=raw
  Allow git-checkout when on a non-existant branch.
  gitweb: Decode long title for link tooltips
  git-svn: Fix fetch --no-ignore-externals with GIT_SVN_NO_LIB=1
  Ignore executable bit when adding files if filemode=0.
  Remove empty ref directories that prevent creating a ref.
  Use const for interpolate arguments
  git-archive: update documentation
  Deprecate merge-recursive.py
  gitweb: fix over-eager application of esc_html().
  Allow '(no author)' in git-svn's authors file.
  Allow 'svn fetch' on '(no date)' revisions in Subversion.
  git-repack: allow git-repack to run in subdirectory
  Remove upload-tar and make git-tar-tree a thin wrapper to git-archive
  git-tar-tree: Move code for git-archive --format=tar to archive-tar.c
  git-tar-tree: Remove duplicate git_config() call
  ...

12 files changed:
1  2 
.gitignore
Makefile
builtin-init-db.c
builtin-update-index.c
builtin.h
cache.h
git-branch.sh
git-checkout.sh
git.c
receive-pack.c
revision.c
sha1_name.c

diff --cc .gitignore
Simple merge
diff --cc Makefile
index af4d68fd7e7faa1d590cf0eef3f2d1a8e435a136,c888c810bf8220c25b9949f47730742347738c32..65fb8284f3c9ef210c08711b5ce4796593e72e75
+++ b/Makefile
@@@ -299,12 -298,8 +299,10 @@@ BUILTIN_OBJS = 
        builtin-update-index.o \
        builtin-update-ref.o \
        builtin-upload-archive.o \
-       builtin-upload-tar.o \
        builtin-verify-pack.o \
 -      builtin-write-tree.o
 +      builtin-write-tree.o \
-       builtin-zip-tree.o \
 +      builtin-show-ref.o \
 +      builtin-pack-refs.o
  
  GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
  LIBS = $(GITLIBS) -lz
Simple merge
Simple merge
diff --cc builtin.h
Simple merge
diff --cc cache.h
Simple merge
diff --cc git-branch.sh
index 4379a07210cf30c5d6e5abdb36722985983edb46,4f31903d63662db7d49d3d257e328004ca2958f7..bf84b30695fdeda5d5e18456813e0b3cc3d11275
@@@ -111,8 -112,17 +111,18 @@@ rev=$(git-rev-parse --verify "$head") |
  git-check-ref-format "heads/$branchname" ||
        die "we do not like '$branchname' as a branch name."
  
 -if [ -e "$GIT_DIR/refs/heads/$branchname" ]
+ if [ -d "$GIT_DIR/refs/heads/$branchname" ]
+ then
+       for refdir in `cd "$GIT_DIR" && \
+               find "refs/heads/$branchname" -type d | sort -r`
+       do
+               rmdir "$GIT_DIR/$refdir" || \
+                   die "Could not delete '$refdir', there may still be a ref there."
+       done
+ fi
 +prev=''
 +if git-show-ref --verify --quiet -- "refs/heads/$branchname"
  then
        if test '' = "$force"
        then
diff --cc git-checkout.sh
Simple merge
diff --cc git.c
Simple merge
diff --cc receive-pack.c
index c8aacbbdd3089fdc412da368ca7609da590e0ca3,ea2dbd4e3398ca90823dcd453cbb52c5dcea135c..1fcf3a91127250448a659fe0d48393c34ecd7c47
@@@ -94,7 -129,50 +96,22 @@@ static int update(struct command *cmd
                return error("unpack should have generated %s, "
                             "but I can't find it!", new_hex);
        }
 -      safe_create_leading_directories(lock_name);
 -
 -      newfd = open(lock_name, O_CREAT | O_EXCL | O_WRONLY, 0666);
 -      if (newfd < 0) {
 -              cmd->error_string = "can't lock";
 -              return error("unable to create %s (%s)",
 -                           lock_name, strerror(errno));
 -      }
 -
 -      /* Write the ref with an ending '\n' */
 -      new_hex[40] = '\n';
 -      new_hex[41] = 0;
 -      written = write(newfd, new_hex, 41);
 -      /* Remove the '\n' again */
 -      new_hex[40] = 0;
 -
 -      close(newfd);
 -      if (written != 41) {
 -              unlink(lock_name);
 -              cmd->error_string = "can't write";
 -              return error("unable to write %s", lock_name);
 -      }
 -      if (verify_old_ref(name, old_hex) < 0) {
 -              unlink(lock_name);
 -              cmd->error_string = "raced";
 -              return error("%s changed during push", name);
 -      }
+       if (deny_non_fast_forwards && !is_null_sha1(old_sha1)) {
+               struct commit *old_commit, *new_commit;
+               struct commit_list *bases, *ent;
+               old_commit = (struct commit *)parse_object(old_sha1);
+               new_commit = (struct commit *)parse_object(new_sha1);
+               bases = get_merge_bases(old_commit, new_commit, 1);
+               for (ent = bases; ent; ent = ent->next)
+                       if (!hashcmp(old_sha1, ent->item->object.sha1))
+                               break;
+               free_commit_list(bases);
+               if (!ent)
+                       return error("denying non-fast forward;"
+                                    " you should pull first");
+       }
        if (run_update_hook(name, old_hex, new_hex)) {
 -              unlink(lock_name);
                cmd->error_string = "hook declined";
                return error("hook declined to update %s", name);
        }
diff --cc revision.c
Simple merge
diff --cc sha1_name.c
Simple merge