Merge branch 'master' into sp/reflog
authorJunio C Hamano <junkio@cox.net>
Wed, 24 May 2006 23:49:24 +0000 (16:49 -0700)
committerJunio C Hamano <junkio@cox.net>
Wed, 24 May 2006 23:49:24 +0000 (16:49 -0700)
* master: (90 commits)
fetch.c: remove an unused variable and dead code.
Clean up sha1 file writing
Builtin git-cat-file
builtin format-patch: squelch content-type for 7-bit ASCII
CMIT_FMT_EMAIL: Q-encode Subject: and display-name part of From: fields.
add more informative error messages to git-mktag
remove the artificial restriction tagsize < 8kb
git-rebase: use canonical A..B syntax to format-patch
git-format-patch: now built-in.
fmt-patch: Support --attach
fmt-patch: understand old <his> notation
Teach fmt-patch about --keep-subject
Teach fmt-patch about --numbered
fmt-patch: implement -o <dir>
fmt-patch: output file names to stdout
Teach fmt-patch to write individual files.
built-in tar-tree and remote tar-tree
Builtin git-diff-files, git-diff-index, git-diff-stages, and git-diff-tree.
Builtin git-show-branch.
Builtin git-apply.
...

1  2 
Documentation/git-branch.txt
Documentation/git-checkout.txt
cache.h
fetch.c
fetch.h
git-am.sh
git-commit.sh
index a7bec3c101bf050347c0ef87d8529d6258926b58,0b37e2bfc85706ca6d41c1c9e4fedcdce53a7578..d43ef1dec4f27361af1a32983c53aeea15468fe9
@@@ -9,7 -9,7 +9,7 @@@ SYNOPSI
  --------
  [verse]
  'git-branch' [-r]
 -'git-branch' [-f] <branchname> [<start-point>]
 +'git-branch' [-l] [-f] <branchname> [<start-point>]
  'git-branch' (-d | -D) <branchname>...
  
  DESCRIPTION
@@@ -23,8 -23,7 +23,8 @@@ If no <start-point> is given, the branc
  equal to that of the currently checked out branch.
  
  With a `-d` or `-D` option, `<branchname>` will be deleted.  You may
 -specify more than one branch for deletion.
 +specify more than one branch for deletion.  If the branch currently
 +has a ref log then the ref log will also be deleted.
  
  
  OPTIONS
  -D::
        Delete a branch irrespective of its index status.
  
 +-l::
 +      Create the branch's ref log.  This activates recording of
 +      all changes to made the branch ref, enabling use of date
 +      based sha1 expressions such as "<branchname>@{yesterday}".
 +
  -f::
        Force the creation of a new branch even if it means deleting
        a branch that already exists with the same name.
@@@ -49,6 -43,9 +49,9 @@@
  
  <branchname>::
        The name of the branch to create or delete.
+       The new branch name must pass all checks defined by
+       gitlink:git-check-ref-format[1].  Some of these checks
+       may restrict the characters allowed in a branch name.
  
  <start-point>::
        The new branch will be created with a HEAD equal to this.  It may
index 064394385486ca032c52e513c071ec08895a04c6,d82efc00d403dc13ac1e85c53083ccc52a4c79f3..fbdbadc74fbe558285323353b7aa006f3cfd559b
@@@ -8,7 -8,7 +8,7 @@@ git-checkout - Checkout and switch to 
  SYNOPSIS
  --------
  [verse]
 -'git-checkout' [-f] [-b <new_branch>] [-m] [<branch>]
 +'git-checkout' [-f] [-b <new_branch> [-l]] [-m] [<branch>]
  'git-checkout' [-m] [<branch>] <paths>...
  
  DESCRIPTION
@@@ -35,13 -35,11 +35,16 @@@ OPTION
        Force a re-read of everything.
  
  -b::
-       Create a new branch and start it at <branch>.
+       Create a new branch named <new_branch> and start it at
+       <branch>.  The new branch name must pass all checks defined
+       by gitlink:git-check-ref-format[1].  Some of these checks
+       may restrict the characters allowed in a branch name.
  
 +-l::
 +      Create the new branch's ref log.  This activates recording of
 +      all changes to made the branch ref, enabling use of date
 +      based sha1 expressions such as "<branchname>@{yesterday}".
 +
  -m::
        If you have local modifications to one or more files that
        are different between the current branch and the branch to
diff --combined cache.h
index f01ca436e64270feb4bb1849376190fbc5693902,3a46fb97bc9e8440228432b57d9c37fefde109c1..07212b62d1fe7f9a821c41fedfe2003eb24df0d9
+++ b/cache.h
@@@ -142,6 -142,7 +142,7 @@@ extern void verify_non_filename(const c
  /* Initialize and use the cache information */
  extern int read_cache(void);
  extern int write_cache(int newfd, struct cache_entry **cache, int entries);
+ extern int verify_path(const char *path);
  extern int cache_name_pos(const char *name, int namelen);
  #define ADD_CACHE_OK_TO_ADD 1         /* Ok to add */
  #define ADD_CACHE_OK_TO_REPLACE 2     /* Ok to replace file/directory */
@@@ -154,10 -155,17 +155,17 @@@ extern int ce_match_stat(struct cache_e
  extern int ce_modified(struct cache_entry *ce, struct stat *st, int);
  extern int ce_path_match(const struct cache_entry *ce, const char **pathspec);
  extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, const char *type);
+ extern int read_pipe(int fd, char** return_buf, unsigned long* return_size);
  extern int index_pipe(unsigned char *sha1, int fd, const char *type, int write_object);
  extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object);
  extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);
  
+ #define REFRESH_REALLY                0x0001  /* ignore_valid */
+ #define REFRESH_UNMERGED      0x0002  /* allow unmerged */
+ #define REFRESH_QUIET         0x0004  /* be quiet about it */
+ #define REFRESH_IGNORE_MISSING        0x0008  /* ignore non-existent */
+ extern int refresh_cache(unsigned int flags);
  struct cache_file {
        struct cache_file *next;
        char lockfile[PATH_MAX];
@@@ -170,7 -178,6 +178,7 @@@ extern void rollback_index_file(struct 
  extern int trust_executable_bit;
  extern int assume_unchanged;
  extern int prefer_symlink_refs;
 +extern int log_all_ref_updates;
  extern int warn_ambiguous_refs;
  extern int diff_rename_limit_default;
  extern int shared_repository;
diff --combined fetch.c
index fd57684d8fad43c92df8005aa8fe7b2cd9263bbb,f7f8902580f0f5e4eb7a63000f9987e63715cd09..ae92d5212e9d80e8cee9a8af752d1b564dbd09db
+++ b/fetch.c
@@@ -8,10 -8,7 +8,8 @@@
  #include "refs.h"
  
  const char *write_ref = NULL;
 +const char *write_ref_log_details = NULL;
  
- const unsigned char *current_ref = NULL;
  int get_tree = 0;
  int get_history = 0;
  int get_all = 0;
@@@ -205,49 -202,23 +203,48 @@@ static int mark_complete(const char *pa
  
  int pull(char *target)
  {
 +      struct ref_lock *lock;
        unsigned char sha1[20];
 +      char *msg;
 +      int ret;
  
        save_commit_buffer = 0;
        track_object_refs = 0;
-               lock = lock_ref_sha1(write_ref, current_ref, 1);
 +      if (write_ref) {
++              lock = lock_ref_sha1(write_ref, NULL, 0);
 +              if (!lock) {
 +                      error("Can't lock ref %s", write_ref);
 +                      return -1;
 +              }
 +      }
  
-       if (!get_recover) {
+       if (!get_recover)
                for_each_ref(mark_complete);
-       }
  
 -      if (interpret_target(target, sha1))
 -              return error("Could not interpret %s as something to pull",
 -                           target);
 -      if (process(lookup_unknown_object(sha1)))
 +      if (interpret_target(target, sha1)) {
 +              error("Could not interpret %s as something to pull", target);
 +              unlock_ref(lock);
                return -1;
 -      if (loop())
 +      }
 +      if (process(lookup_unknown_object(sha1))) {
 +              unlock_ref(lock);
                return -1;
 -      
 -      if (write_ref)
 -              write_ref_sha1_unlocked(write_ref, sha1);
 +      }
 +      if (loop()) {
 +              unlock_ref(lock);
 +              return -1;
 +      }
 +
 +      if (write_ref) {
 +              if (write_ref_log_details) {
 +                      msg = xmalloc(strlen(write_ref_log_details) + 12);
 +                      sprintf(msg, "fetch from %s", write_ref_log_details);
 +              } else
 +                      msg = NULL;
 +              ret = write_ref_sha1(lock, sha1, msg ? msg : "fetch (unknown)");
 +              if (msg)
 +                      free(msg);
 +              return ret;
 +      }
        return 0;
  }
diff --combined fetch.h
index 0011548de8c3aa085944ac56a1568a433834145f,001a6b8e2dccc02a64266ae804227674ee71338c..841bb1af9cab0c19dda3f0cb5956edaec22f9d3a
+++ b/fetch.h
@@@ -25,12 -25,6 +25,9 @@@ extern int fetch_ref(char *ref, unsigne
  /* If set, the ref filename to write the target value to. */
  extern const char *write_ref;
  
- /* If set, the hash that the current value of write_ref must be. */
- extern const unsigned char *current_ref;
 +/* If set additional text will appear in the ref log. */
 +extern const char *write_ref_log_details;
 +
  /* Set to fetch the target tree. */
  extern int get_tree;
  
diff --combined git-am.sh
index 25c95c24fde6894544f4b53439abd030008e757f,97ec2d0c7db521047e254e53120ffc83829868a9..4232e27411036e339f8102e45b7cb699c808a798
+++ b/git-am.sh
@@@ -59,46 -59,12 +59,12 @@@ fall_back_3way () 
        GIT_INDEX_FILE="$dotest/patch-merge-tmp-index" \
        git-write-tree >"$dotest/patch-merge-base+" &&
        # index has the base tree now.
-       (
-           cd "$dotest/patch-merge-tmp-dir" &&
-           GIT_INDEX_FILE="../patch-merge-tmp-index" \
-           GIT_OBJECT_DIRECTORY="$O_OBJECT" \
-           git-apply $binary --index <../patch
-         )
+       GIT_INDEX_FILE="$dotest/patch-merge-tmp-index" \
+       git-apply $binary --cached <"$dotest/patch"
      then
        echo Using index info to reconstruct a base tree...
        mv "$dotest/patch-merge-base+" "$dotest/patch-merge-base"
        mv "$dotest/patch-merge-tmp-index" "$dotest/patch-merge-index"
-     else
-       # Otherwise, try nearby trees that can be used to apply the
-       # patch.
-       (
-           N=10
-           # Hoping the patch is against our recent commits...
-           git-rev-list --max-count=$N HEAD
-           # or hoping the patch is against known tags...
-           git-ls-remote --tags .
-       ) |
-       while read base junk
-       do
-           # See if we have it as a tree...
-           git-cat-file tree "$base" >/dev/null 2>&1 || continue
-           rm -fr "$dotest"/patch-merge-* &&
-           mkdir "$dotest/patch-merge-tmp-dir" || break
-           (
-               cd "$dotest/patch-merge-tmp-dir" &&
-               GIT_INDEX_FILE=../patch-merge-tmp-index &&
-               GIT_OBJECT_DIRECTORY="$O_OBJECT" &&
-               export GIT_INDEX_FILE GIT_OBJECT_DIRECTORY &&
-               git-read-tree "$base" &&
-               git-apply $binary --index &&
-               mv ../patch-merge-tmp-index ../patch-merge-index &&
-               echo "$base" >../patch-merge-base
-           ) <"$dotest/patch"  2>/dev/null && break
-       done
      fi
  
      test -f "$dotest/patch-merge-index" &&
@@@ -447,7 -413,7 +413,7 @@@ d
        parent=$(git-rev-parse --verify HEAD) &&
        commit=$(git-commit-tree $tree -p $parent <"$dotest/final-commit") &&
        echo Committed: $commit &&
 -      git-update-ref HEAD $commit $parent ||
 +      git-update-ref -m "am: $SUBJECT" HEAD $commit $parent ||
        stop_here $this
  
        if test -x "$GIT_DIR"/hooks/post-applypatch
diff --combined git-commit.sh
index a4b0a907404f84581503d62011e5e82ecf50e715,6785826fef91d35277107ae15a96619d2f5113c6..0a01a0b96a0ae92e7cd7828ad622281bfcd72283
@@@ -3,7 -3,7 +3,7 @@@
  # Copyright (c) 2005 Linus Torvalds
  # Copyright (c) 2006 Junio C Hamano
  
- USAGE='[-a] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit>) [--amend] [-e] [--author <author>] [[-i | -o] <path>...]'
+ USAGE='[-a] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit>] [-u] [--amend] [-e] [--author <author>] [[-i | -o] <path>...]'
  SUBDIRECTORY_OK=Yes
  . git-sh-setup
  
@@@ -134,13 -134,17 +134,17 @@@ run_status () 
        report "Changed but not updated" \
            "use git-update-index to mark for commit"
  
+         option=""
+         if test -z "$untracked_files"; then
+             option="--directory --no-empty-directory"
+         fi
        if test -f "$GIT_DIR/info/exclude"
        then
-           git-ls-files -z --others --directory \
+           git-ls-files -z --others $option \
                --exclude-from="$GIT_DIR/info/exclude" \
                --exclude-per-directory=.gitignore
        else
-           git-ls-files -z --others --directory \
+           git-ls-files -z --others $option \
                --exclude-per-directory=.gitignore
        fi |
        perl -e '$/ = "\0";
@@@ -203,6 -207,7 +207,7 @@@ verbose
  signoff=
  force_author=
  only_include_assumed=
+ untracked_files=
  while case "$#" in 0) break;; esac
  do
    case "$1" in
        verbose=t
        shift
        ;;
+   -u|--u|--un|--unt|--untr|--untra|--untrac|--untrack|--untracke|--untracked|\
+   --untracked-|--untracked-f|--untracked-fi|--untracked-fil|--untracked-file|\
+   --untracked-files)
+       untracked_files=t
+       shift
+       ;;
    --)
        shift
        break
@@@ -676,8 -687,7 +687,8 @@@ the
                rm -f "$TMP_INDEX"
        fi &&
        commit=$(cat "$GIT_DIR"/COMMIT_MSG | git-commit-tree $tree $PARENTS) &&
 -      git-update-ref HEAD $commit $current &&
 +      rlogm=$(sed -e 1q "$GIT_DIR"/COMMIT_MSG) &&
 +      git-update-ref -m "commit: $rlogm" HEAD $commit $current &&
        rm -f -- "$GIT_DIR/MERGE_HEAD" &&
        if test -f "$NEXT_INDEX"
        then