1. 16 4月, 2006 5 次提交
    • L
      Tentative built-in "git show" · ba1d4505
      Linus Torvalds 提交于
      This uses the "--no-walk" flag that I never actually implemented (but I'm
      sure I mentioned it) to make "git show" be essentially the same thing as
      "git whatchanged --no-walk".
      
      It just refuses to add more interesting parents to the revision walking
      history, so you don't actually get any history, you just get the commit
      you asked for.
      
      I was going to add "--no-walk" as a real argument flag to git-rev-list
      too, but I'm not sure anybody actually needs it. Although it might be
      useful for porcelain, so I left the door open.
      
      [jc: ported to the unified option structure by Linus]
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      ba1d4505
    • J
      Built-in git-whatchanged. · 5b84f4d8
      Junio C Hamano 提交于
      Split internal "git log" into reusable piece and add "git
      whatchanged".  This is based on the option parsing unification
      work Linus did.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      5b84f4d8
    • J
      Split init_revisions() out of setup_revisions() · 6b9c58f4
      Junio C Hamano 提交于
      Merging all three option parsers related to whatchanged is
      unarguably the right thing, but the fallout was too big to scare
      me away.  Let's try it once again, but once step at time.
      
      This splits out init_revisions() call from setup_revisions(), so
      that the callers can set different defaults to match the
      traditional benaviour.
      
      The rev-list command is still broken in a big way, which is the
      topic of next step.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      6b9c58f4
    • L
      Support "git cmd --help" syntax · 1cd95087
      Linus Torvalds 提交于
      The "--help" argument is special, in that it is (along with "--version")
      in that is taken by the "git" program itself rather than the sub-command,
      and thus we've had the syntax "git --help cmd".
      
      However, as anybody who has ever used CVS or some similar devil-spawn
      program, it's confusing as h*ll when options before the sub-command act
      differently from options after the sub-command, so this quick hack just
      makes it acceptable to do "git cmd --help" instead, and get the exact same
      result.
      
      It may be hacky, but it's simple and does the trick.
      
      Of course, this does not help if you use one of the non-builtin commands
      without using the "git" helper. Ie you won't be getting a man-page just
      because you do "git-rev-list --help". Don't expect us to be quite _that_
      helpful.
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      1cd95087
    • J
      diff --stat: do not do its own three-dashes. · 6f4780f9
      Junio C Hamano 提交于
      I missed that "git-diff-* --stat" spits out three-dash separator
      on its own without being asked.  Remove it.
      
      When we output commit log followed by diff, perhaps --patch-with-stat,
      for downstream consumer, we _would_ want the three-dash between
      the message and the diff material, but that logic belongs to the
      caller, not diff generator.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      6f4780f9
  2. 15 4月, 2006 2 次提交
    • J
      Fix up default abbrev in setup_revisions() argument parser. · 8e8f9987
      Junio C Hamano 提交于
      The default abbreviation precision should be DEFAULT_ABBREV as before.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      8e8f9987
    • L
      Common option parsing for "git log --diff" and friends · cd2bdc53
      Linus Torvalds 提交于
      This basically does a few things that are sadly somewhat interdependent,
      and nontrivial to split out
      
       - get rid of "struct log_tree_opt"
      
         The fields in "log_tree_opt" are moved into "struct rev_info", and all
         users of log_tree_opt are changed to use the rev_info struct instead.
      
       - add the parsing for the log_tree_opt arguments to "setup_revision()"
      
       - make setup_revision set a flag (revs->diff) if the diff-related
         arguments were used. This allows "git log" to decide whether it wants
         to show diffs or not.
      
       - make setup_revision() also initialize the diffopt part of rev_info
         (which we had from before, but we just didn't initialize it)
      
       - make setup_revision() do all the "finishing touches" on it all (it will
         do the proper flag combination logic, and call "diff_setup_done()")
      
      Now, that was the easy and straightforward part.
      
      The slightly more involved part is that some of the programs that want to
      use the new-and-improved rev_info parsing don't actually want _commits_,
      they may want tree'ish arguments instead. That meant that I had to change
      setup_revision() to parse the arguments not into the "revs->commits" list,
      but into the "revs->pending_objects" list.
      
      Then, when we do "prepare_revision_walk()", we walk that list, and create
      the sorted commit list from there.
      
      This actually cleaned some stuff up, but it's the less obvious part of the
      patch, and re-organized the "revision.c" logic somewhat. It actually paves
      the way for splitting argument parsing _entirely_ out of "revision.c",
      since now the argument parsing really is totally independent of the commit
      walking: that didn't use to be true, since there was lots of overlap with
      get_commit_reference() handling etc, now the _only_ overlap is the shared
      (and trivial) "add_pending_object()" thing.
      
      However, I didn't do that file split, just because I wanted the diff
      itself to be smaller, and show the actual changes more clearly. If this
      gets accepted, I'll do further cleanups then - that includes the file
      split, but also using the new infrastructure to do a nicer "git diff" etc.
      
      Even in this form, it actually ends up removing more lines than it adds.
      
      It's nice to note how simple and straightforward this makes the built-in
      "git log" command, even though it continues to support all the diff flags
      too. It doesn't get much simpler that this.
      
      I think this is worth merging soonish, because it does allow for future
      cleanup and even more sharing of code. However, it obviously touches
      "revision.c", which is subtle. I've tested that it passes all the tests we
      have, and it passes my "looks sane" detector, but somebody else should
      also give it a good look-over.
      
      [jc: squashed the original and three "oops this too" updates, with
       another fix-up.]
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      cd2bdc53
  3. 14 4月, 2006 1 次提交
    • L
      Use less memory in "git log" · f43ba60e
      Linus Torvalds 提交于
      This trivially avoids keeping the commit message data around after we
      don't need it any more, avoiding a continually growing "git log" memory
      footprint.
      
      It's not a huge deal, but it's somewhat noticeable. For the current kernel
      tree, doing a full "git log" I got
      
       - before: /usr/bin/time git log > /dev/null
      	0.81user 0.02system 0:00.84elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
      	0inputs+0outputs (0major+8851minor)pagefaults 0swaps
      
       - after: /usr/bin/time git log > /dev/null
      	0.79user 0.03system 0:00.83elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
      	0inputs+0outputs (0major+5039minor)pagefaults 0swaps
      
      ie the touched pages dropped from 8851 to 5039. For the historic kernel
      archive, the numbers are 18357->11037 minor page faults.
      
      We could/should in theory free the commits themselves, but that's really a
      lot harder, since during revision traversal we may hit the same commit
      twice through different children having it as a parent, even after we've
      shown it once (when that happens, we'll silently ignore it next time, but
      we still need the "struct commit" to know).
      
      And as the commit message data is clearly the biggest part of the commit,
      this is the really easy 60% solution.
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      f43ba60e
  4. 13 4月, 2006 1 次提交
  5. 11 4月, 2006 2 次提交
  6. 09 4月, 2006 2 次提交
  7. 03 4月, 2006 1 次提交
  8. 01 4月, 2006 1 次提交
  9. 10 3月, 2006 2 次提交
  10. 05 3月, 2006 1 次提交
    • J
      Const tightening. · 9201c707
      Junio C Hamano 提交于
      Mark Wooding noticed there was a type mismatch warning in git.c; this
      patch does things slightly differently (mostly tightening const) and
      was what I was holding onto, waiting for the setup-revisions change
      to be merged into the master branch.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      9201c707
  11. 03 3月, 2006 1 次提交
  12. 01 3月, 2006 2 次提交
    • J
      git-log (internal): more options. · 7ae0b0cb
      Junio C Hamano 提交于
      This ports the following options from rev-list based git-log
      implementation:
      
       * -<n>, -n<n>, and -n <n>.  I am still wondering if we want
          this natively supported by setup_revisions(), which already
          takes --max-count.  We may want to move them in the next
          round.  Also I am not sure if we can get away with not
          setting revs->limited when we set max-count.  The latest
          rev-list.c and revision.c in this series do not, so I left
          them as they are.
      
       * --pretty and --pretty=<fmt>.
      
       * --abbrev=<n> and --no-abbrev.
      
      The previous commit already handles time-based limiters
      (--since, --until and friends).  The remaining things that
      rev-list based git-log happens to do are not useful in a pure
      log-viewing purposes, and not ported:
      
       * --bisect (obviously).
      
       * --header.  I am actually in favor of doing the NUL
         terminated record format, but rev-list based one always
         passed --pretty, which defeated this option.  Maybe next
         round.
      
       * --parents.  I do not think of a reason a log viewer wants
         this.  The flag is primarily for feeding squashed history
         via pipe to downstream tools.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      7ae0b0cb
    • L
      Tie it all together: "git log" · 70b006b9
      Linus Torvalds 提交于
      This is what the previous diffs all built up to.
      
      We can do "git log" as a trivial small helper function inside git.c,
      because the infrastructure is all there for us to use as a library.
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      70b006b9
  13. 27 2月, 2006 1 次提交
    • L
      Teach the "git" command to handle some commands internally · 231af832
      Linus Torvalds 提交于
      This is another patch in the "prepare to do more in C" series, where the
      git wrapper command is taught about the notion of handling some
      functionality internally.
      
      Right now, the only internal commands are "version" and "help", but the
      point being that we can now easily extend it to handle some of the trivial
      scripts internally. Things like "git log" and "git diff" wouldn't need
      separate external scripts any more.
      
      This also implies that to support the old "git-log" and "git-diff" syntax,
      the "git" wrapper now automatically looks at the name it was executed as,
      and if it is "git-xxxx", it will assume that it is to internally do what
      "git xxxx" would do.
      
      In other words, you can (once you implement an internal command) soft- or
      hard-link that command to the "git" wrapper command, and it will do the
      right thing, whether you use the "git xxxx" or the "git-xxxx" format.
      
      There's one other change: the search order for external programs is
      modified slightly, so that the first entry remains GIT_EXEC_DIR, but the
      second entry is the same directory as the git wrapper itself was executed
      out of - if we can figure it out from argv[0], of course.
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      231af832
  14. 14 1月, 2006 1 次提交
    • M
      Exec git programs without using PATH. · 77cb17e9
      Michal Ostrowski 提交于
      The git suite may not be in PATH (and thus programs such as
      git-send-pack could not exec git-rev-list).  Thus there is a need for
      logic that will locate these programs.  Modifying PATH is not
      desirable as it result in behavior differing from the user's
      intentions, as we may end up prepending "/usr/bin" to PATH.
      
      - git C programs will use exec*_git_cmd() APIs to exec sub-commands.
      - exec*_git_cmd() will execute a git program by searching for it in
        the following directories:
      	1. --exec-path (as used by "git")
      	2. The GIT_EXEC_PATH environment variable.
      	3. $(gitexecdir) as set in Makefile (default value $(bindir)).
      - git wrapper will modify PATH as before to enable shell scripts to
        invoke "git-foo" commands.
      
      Ideally, shell scripts should use the git wrapper to become independent
      of PATH, and then modifying PATH will not be necessary.
      
      [jc: with minor updates after a brief review.]
      Signed-off-by: NMichal Ostrowski <mostrows@watson.ibm.com>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      77cb17e9
  15. 06 1月, 2006 1 次提交
  16. 22 12月, 2005 1 次提交
  17. 19 12月, 2005 2 次提交
    • L
      Make "git help" sort git commands in columns · 112d0baf
      Linus Torvalds 提交于
      This changes "pretty_print_string_list()" to show the git commands
      alphabetically in column order, which is the normal one.
      
      Ie instead of doing
      
      	git commands available in '/home/torvalds/bin'
      	----------------------------------------------
      	  add                am                 ...
      	  applypatch         archimport         ...
      	  cat-file           check-ref-format   ...
      	...
      
      it does
      
      	git commands available in '/home/torvalds/bin'
      	----------------------------------------------
      	  add                diff-tree          ...
      	  am                 fetch              ...
      	  apply              fetch-pack         ...
      	...
      
      where each column is sorted.
      
      This is how "ls" sorts things too, and since visually the columns are much
      more distinct than the rows, so it _looks_ more sorted.
      
      The "ls" command has a "-x" option that lists entries by lines (the way
      git.c used to): if somebody wants to do that, the new print-out logic
      could be easily accomodated to that too. Matter of taste and preference, I
      guess.
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      112d0baf
    • L
      Make "git help" react to window size correctly · ea77e675
      Linus Torvalds 提交于
      Currently the git "show commands" function will react to the environment
      variable COLUMNS, or just default to a width of 80 characters.
      
      That's just soo eighties. Nobody sane sets COLUMNS any more, unless they
      need to support some stone-age software from before the age of steam
      engines, SIGWINCH and TIOCGWINSZ.
      
      So get with the new century, and use TIOCGWINSZ to get the terminal size.
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      ea77e675
  18. 06 12月, 2005 1 次提交
    • J
      Clean up compatibility definitions. · 4050c0df
      Junio C Hamano 提交于
      This attempts to clean up the way various compatibility
      functions are defined and used.
      
       - A new header file, git-compat-util.h, is introduced.  This
         looks at various NO_XXX and does necessary function name
         replacements, equivalent of -Dstrcasestr=gitstrcasestr in the
         Makefile.
      
       - Those function name replacements are removed from the Makefile.
      
       - Common features such as usage(), die(), xmalloc() are moved
         from cache.h to git-compat-util.h; cache.h includes
         git-compat-util.h itself.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      4050c0df
  19. 05 12月, 2005 2 次提交
  20. 04 12月, 2005 1 次提交
    • J
      Add compat/setenv.c, use in git.c. · e40b61fb
      Jason Riedy 提交于
      There is no setenv() in Solaris 5.8.  The trivial calls to
      setenv() were replaced by putenv() in a much earlier patch,
      but setenv() was used again in git.c.  This patch just adds
      a compat/setenv.c.
      
      The rule for building git$(X) also needs to include compat.
      objects and compiler flags.  Those are now in makefile vars
      COMPAT_OBJS and COMPAT_CFLAGS.
      Signed-off-by: NE. Jason Riedy <ejr@cs.berkeley.edu>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      e40b61fb
  21. 02 12月, 2005 1 次提交
  22. 25 11月, 2005 1 次提交
  23. 19 11月, 2005 1 次提交
  24. 17 11月, 2005 1 次提交
  25. 16 11月, 2005 3 次提交
    • J
      git wrapper: basic fixes. · 7dbc2c04
      Junio C Hamano 提交于
      Updates to fix the nits found during the list discussion.
      
       - Lose PATH_TO_MAN; just rely on execlp() to find whereever the
         "man" command is installed.
      
       - Do not randomly chdir(), but concatenate to the current
         working directory only if the given path is not absolute.
      
       - Lose use of glob(); read from exec_path and do sorting
         ourselves -- it is not that much more work.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      7dbc2c04
    • A
      git --help COMMAND brings up the git-COMMAND man-page. · 97fc6c5f
      Andreas Ericsson 提交于
      It's by design a bit stupid (matching ^git rather than ^git-), so as
      to work with 'gitk' and 'git' as well.
      Signed-off-by: NAndreas Ericsson <ae@op5.se>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      97fc6c5f
    • A
      C implementation of the 'git' program, take two. · 8e49d503
      Andreas Ericsson 提交于
      This patch provides a C implementation of the 'git' program and
      introduces support for putting the git-* commands in a directory
      of their own. It also saves some time on executing those commands
      in a tight loop and it prints the currently available git commands
      in a nicely formatted list.
      
      The location of the GIT_EXEC_PATH (name discussion's closed, thank gods)
      can be obtained by running
      
      	git --exec-path
      
      which will hopefully give porcelainistas ample time to adapt their
      heavy-duty loops to call the core programs directly and thus save
      the extra fork() / execve() overhead, although that's not really
      necessary any more.
      
      The --exec-path value is prepended to $PATH, so the git-* programs
      should Just Work without ever requiring any changes to how they call
      other programs in the suite.
      
      Some timing values for 10000 invocations of git-var >&/dev/null:
      	git.sh: 24.194s
      	git.c:   9.044s
      	git-var: 7.377s
      
      The git-<tab><tab> behaviour can, along with the someday-to-be-deprecated
      git-<command> form of invocation, be indefinitely retained by adding
      the following line to one's .bash_profile or equivalent:
      
      	PATH=$PATH:$(git --exec-path)
      
      Experimental libraries can be used by either setting the environment variable
      GIT_EXEC_PATH, or by using
      
      	git --exec-path=/some/experimental/exec-path
      
      Relative paths are properly grok'ed as exec-path values.
      Signed-off-by: NAndreas Ericsson <ae@op5.se>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      8e49d503