Git development
 help / color / mirror / Atom feed
* What's cooking in git.git (Jan 2009, #07; Wed, 28)
From: Junio C Hamano @ 2009-01-29  2:06 UTC (permalink / raw)
  To: git

Here are the topics that have been cooking.  Commits prefixed with '-' are
only in 'pu' while commits prefixed with '+' are in 'next'.  The ones
marked with '.' do not appear in any of the branches, but I am still
holding onto them.

The topics list the commits in reverse chronological order.  The topics
meant to be merged to the maintenance series have "maint-" in their names.

----------------------------------------------------------------
[New Topics]

* jc/maint-1.6.0-split-diff-metainfo (Mon Jan 26 00:08:24 2009 -0800) 1 commit
 + diff.c: output correct index lines for a split diff

This is slated for maintenance series 1.6.0.X, 1.6.1.X and also for
'master'.  I think the change is pretty safe and sane to go directly to
'master' but I had too many other topoics to look at that I did not feel
comfortable enough to do so.

* jc/maint-split-diff-metainfo (Tue Jan 27 01:08:02 2009 -0800) 2 commits
 + Merge branch 'jc/maint-1.6.0-split-diff-metainfo' into jc/maint-
   split-diff-metainfo
 + diff.c: output correct index lines for a split diff

Early conflict resolution branch for the above to carry it to 1.6.1X
series.

* js/maint-rebase-i-submodule (Tue Jan 27 12:42:31 2009 +0100) 2 commits
 + Fix submodule squashing into unrelated commit
 + rebase -i squashes submodule changes into unrelated commit

* jg/tag-contains (Mon Jan 26 09:13:25 2009 -0500) 3 commits
 + git-tag: Add --contains option
 + Make has_commit() non-static
 + Make opt_parse_with_commit() non-static

* jk/maint-cleanup-after-exec-failure (Wed Jan 28 02:38:14 2009 -0500) 4 commits
 + git: use run_command() to execute dashed externals
 + run_command(): help callers distinguish errors
 + run_command(): handle missing command errors more gracefully
 + git: s/run_command/run_builtin/

* jc/maint-allow-uninteresting-missing (Tue Jan 27 23:19:30 2009 -0800) 1 commit
 + revision traversal: allow UNINTERESTING objects to be missing

This is a small follow-up to the fix to send-pack in 1.6.1; meant to go in
1.6.1.X maintenance series and newer.

* am/maint-push-doc (Mon Jan 26 00:45:33 2009 +0100) 3 commits
 + Documentation: rework src/dst description in git push
 + Documentation: more git push examples
 + Documentation: simplify refspec format description

* jc/merge-convert (Mon Jan 26 16:45:01 2009 -0800) 1 commit
 - git-merge-file: allow converting the results for the work tree

We did not give scripted Porcelains a way to say "this temporary file I am
using for merging is for this path, so use the core.autocrlf and attributes
rules for that final path".  Instead, merge-file simply wrote out the
data in the canonical repository representation.

rerere has the same issue, but it is a lot worse.  It reads the three
files (preimage, postimage and thisimage) from the work tree in the work
tree representation, merges them without converting them to the canonical
representation first but inserts the conflict markers with the canonical
representation and writes the resulting mess out.  It needs to be fixed to
read with convert_to_git(), merge them while they are still in the
canonical representation and possibly add conflict markers, and then write
the results out after convert_to_working_tree().  It also needs to write
in binary mode as well.

* jc/maint-add-u-remove-conflicted (Wed Jan 28 14:24:53 2009 -0800) 1 commit
 - add -u: do not fail to resolve a path as deleted

This has been updated from the posted version with a correction.

* ns/am-slacker (Sat Jan 24 10:18:02 2009 +0900) 2 commits
 + git-am: Add --ignore-date option
 + am: Add --committer-date-is-author-date option

It is a (probably) useful new feature with a sort-of cute explanation.

* jc/maint-apply-fix (Sun Jan 25 23:41:26 2009 -0800) 1 commit
 + builtin-apply.c: do not set bogus mode in check_preimage() for
   deleted path

----------------------------------------------------------------
[Stalled and may need help and prodding to go forward]

* jc/blame (Wed Jun 4 22:58:40 2008 -0700) 2 commits
 + blame: show "previous" information in --porcelain/--incremental
   format
 + git-blame: refactor code to emit "porcelain format" output

This gives Porcelains (like gitweb) the information on the commit _before_
the one that the final blame is laid on, which should save them one
rev-parse to dig further.  The line number in the "previous" information
may need refining, and sanity checking code for reference counting may
need to be resurrected before this can move forward.

* db/foreign-scm (Sun Jan 11 15:12:10 2009 -0500) 3 commits
 - Support fetching from foreign VCSes
 - Add specification of git-vcs helpers
 - Add "vcs" config option in remotes

The "spec" did not seem quite well cooked yet, but in the longer term I
think something like this to allow interoperating with other SCMs as if
the other end is a native git repository is a very worthy goal.

* cc/replace (Fri Jan 23 10:07:46 2009 +0100) 7 commits
 - environment: add global variable to disable replacement
 - mktag: call "check_sha1_signature" with the replacement sha1
 - replace_object: add a test case
 - object: call "check_sha1_signature" with the replacement sha1
 - sha1_file: add a "read_sha1_file_repl" function
 - replace_object: add mechanism to replace objects found in
   "refs/replace/"
 - refs: add a "for_each_replace_ref" function

Nobody has review comments on this yet.

* lh/submodule-tree-traversal (Sun Jan 25 01:52:06 2009 +0100) 6 commits
 - archive.c: add support for --submodules[=(all|checkedout)]
 - tree.c: allow read_tree_recursive() to traverse gitlink entries
 + Revert round #1 of the series
 + builtin-ls-tree: enable traversal of submodules
 + archive.c: enable traversal of submodules
 + tree.c: add support for traversal of submodules

----------------------------------------------------------------
[Reverted]

* mh/unify-color (Fri Jan 23 01:25:23 2009 -0800) 3 commits
 ? Revert previous two commits
 ? move the color variables to color.c
 ? handle color.ui at a central place

This broke git-format-patch badly.

----------------------------------------------------------------
[Actively cooking]

* js/valgrind (Wed Jan 21 02:36:40 2009 +0100) 2 commits
 - valgrind: ignore ldso errors
 - Add valgrind support in test scripts

Dscho and Peff had further exchanges on the list; I am sort of waiting for
the conclusion before picking any intermediate version up.

* ks/maint-mailinfo-folded (Tue Jan 13 01:21:04 2009 +0300) 4 commits
 + mailinfo: tests for RFC2047 examples
 + mailinfo: add explicit test for mails like '<a.u.thor@example.com>
   (A U Thor)'
 + mailinfo: 'From:' header should be unfold as well
 + mailinfo: correctly handle multiline 'Subject:' header

I just got tired of waiting and cleaned up the series myself.

* js/notes (Tue Jan 13 20:57:16 2009 +0100) 6 commits
 + git-notes: fix printing of multi-line notes
 + notes: fix core.notesRef documentation
 + Add an expensive test for git-notes
 + Speed up git notes lookup
 + Add a script to edit/inspect notes
 + Introduce commit notes

It would be nice to hear a real world success story using the notes
mechanism; Dscho says he also wants to make sure the current choice
of the structure scales well before casting it in stone.

* sc/gitweb-category (Fri Dec 12 00:45:12 2008 +0100) 3 commits
 - gitweb: Optional grouping of projects by category
 - gitweb: Split git_project_list_body in two functions
 - gitweb: Modularized git_get_project_description to be more generic

Design discussion between Jakub and Sebastien continues.

----------------------------------------------------------------
[Graduated to "master"]

* sr/clone-empty (Fri Jan 23 01:07:32 2009 +0100) 1 commit
 + Allow cloning an empty repository

Has anybody actually tried this and made sure the resulting empty clone
works fine after the clone source gets updated with some contents?

* kb/lstat-cache (Sun Jan 18 16:14:54 2009 +0100) 5 commits
 + lstat_cache(): introduce clear_lstat_cache() function
 + lstat_cache(): introduce invalidate_lstat_cache() function
 + lstat_cache(): introduce has_dirs_only_path() function
 + lstat_cache(): introduce has_symlink_or_noent_leading_path()
   function
 + lstat_cache(): more cache effective symlink/directory detection

* tr/previous-branch (Wed Jan 21 00:37:38 2009 -0800) 10 commits
 + Simplify parsing branch switching events in reflog
 + Introduce for_each_recent_reflog_ent().
 + interpret_nth_last_branch(): plug small memleak
 + Fix reflog parsing for a malformed branch switching entry
 + Fix parsing of @{-1}@{1}
 + interpret_nth_last_branch(): avoid traversing the reflog twice
 + checkout: implement "-" abbreviation, add docs and tests
 + sha1_name: support @{-N} syntax in get_sha1()
 + sha1_name: tweak @{-N} lookup
 + checkout: implement "@{-N}" shortcut name for N-th last branch

* js/maint-all-implies-HEAD (Sat Jan 17 22:27:08 2009 -0800) 2 commits
 + bundle: allow the same ref to be given more than once
 + revision walker: include a detached HEAD in --all

* cb/add-pathspec (Wed Jan 14 15:54:35 2009 +0100) 2 commits
 + remove pathspec_match, use match_pathspec instead
 + clean up pathspec matching

* js/diff-color-words (Tue Jan 20 22:59:54 2009 -0600) 9 commits
 + Change the spelling of "wordregex".
 + color-words: Support diff.wordregex config option
 + color-words: make regex configurable via attributes
 + color-words: expand docs with precise semantics
 + color-words: enable REG_NEWLINE to help user
 + color-words: take an optional regular expression describing words
 + color-words: change algorithm to allow for 0-character word
   boundaries
 + color-words: refactor word splitting and use ALLOC_GROW()
 + Add color_fwrite_lines(), a function coloring each line
   individually

----------------------------------------------------------------
[Will merge to "master" soon]

* jg/mergetool (Sat Jan 24 00:12:45 2009 +0100) 1 commit
 + mergetool: Don't repeat merge tool candidates

* cb/mergetool (Wed Jan 21 22:57:48 2009 +0000) 1 commit
 + mergetool: respect autocrlf by using checkout-index

Now Ted told us not to wait for him, we'll go ahead by ourselves ;-).

* jk/signal-cleanup (Thu Jan 22 01:03:28 2009 -0500) 5 commits
 + pager: do wait_for_pager on signal death
 + refactor signal handling for cleanup functions
 + chain kill signals for cleanup functions
 + diff: refactor tempfile cleanup handling
 + Windows: Fix signal numbers

* sp/runtime-prefix (Sun Jan 18 13:00:15 2009 +0100) 7 commits
 + Windows: Revert to default paths and convert them by
   RUNTIME_PREFIX
 + Compute prefix at runtime if RUNTIME_PREFIX is set
 + Modify setup_path() to only add git_exec_path() to PATH
 + Add calls to git_extract_argv0_path() in programs that call
   git_config_*
 + git_extract_argv0_path(): Move check for valid argv0 from caller
   to callee
 + Refactor git_set_argv0_path() to git_extract_argv0_path()
 + Move computation of absolute paths from Makefile to runtime (in
   preparation for RUNTIME_PREFIX)

----------------------------------------------------------------
[On Hold]

* jc/commit-assume-also-during-merge (Thu Jan 22 22:21:49 2009 -0800) 3 commits
 - git commit: pathspec without -i/-o implies -i semantics during a
   merge
 - builtin-commit: shorten eye-sore overlong lines
 - Add "partial commit" tests during a conflicted merge

This is only meant as a weatherballoon to help facilitate discussion.

* jk/renamelimit (Sat May 3 13:58:42 2008 -0700) 1 commit
 . diff: enable "too large a rename" warning when -M/-C is explicitly
   asked for

* jc/stripspace (Sun Mar 9 00:30:35 2008 -0800) 6 commits
 . git-am --forge: add Signed-off-by: line for the author
 . git-am: clean-up Signed-off-by: lines
 . stripspace: add --log-clean option to clean up signed-off-by:
   lines
 . stripspace: use parse_options()
 . Add "git am -s" test
 . git-am: refactor code to add signed-off-by line for the committer

* jc/post-simplify (Fri Aug 15 01:34:51 2008 -0700) 2 commits
 . revision --simplify-merges: incremental simplification
 . revision --simplify-merges: prepare for incremental simplification

* jk/valgrind (Thu Oct 23 04:30:45 2008 +0000) 2 commits
 . valgrind: ignore ldso errors
 . add valgrind support in test scripts

* wp/add-patch-find (Thu Nov 27 04:08:03 2008 +0000) 3 commits
 . In add --patch, Handle K,k,J,j slightly more gracefully.
 . Add / command in add --patch
 . git-add -i/-p: Change prompt separater from slash to comma

^ permalink raw reply

* What's in git.git (Jan 2009, #04; Wed, 28)
From: Junio C Hamano @ 2009-01-29  2:06 UTC (permalink / raw)
  To: git

Folks at Github found that v1.6.1 clients barf when pushing over git
protocol to v1.6.1 server if (1) the repository pushed into borrows
objects from another repository, and (2) the repository that lends the
objects has updates the pusher does not have.  The 'maint' branch has a
fix for it which 1.6.1.2 will contain when it comes out.

The master has accumulated enough new features; we should start the -rc
freeze soon (with the topics we have in 'next' as of today).


* The 'maint' branch has these fixes since the last announcement.

Johannes Schindelin (2):
  get_sha1_basic(): fix invalid memory access, found by valgrind
  test-path-utils: Fix off by one, found by valgrind

Junio C Hamano (2):
  GIT 1.6.1.1
  send-pack: do not send unknown object name from ".have" to pack-objects


* The 'master' branch has these since the last announcement
  in addition to the above.

Benjamin Kramer (1):
  Ignore test-ctype

Boyd Stephen Smith Jr (2):
  color-words: Support diff.wordregex config option
  Change the spelling of "wordregex".

Clemens Buchacher (2):
  clean up pathspec matching
  remove pathspec_match, use match_pathspec instead

Eric Wong (1):
  git-svn: fix memory leak when checking for empty symlinks

Giuseppe Bilotta (6):
  gitweb: channel image in rss feed
  gitweb: feed generator metadata
  gitweb: rss feed managingEditor
  gitweb: rss channel date
  gitweb: last-modified time should be commiter, not author
  gitweb: check if-modified-since for feeds

Jay Soffian (1):
  git-am: minor cleanups

Johannes Schindelin (7):
  Add color_fwrite_lines(), a function coloring each line individually
  color-words: refactor word splitting and use ALLOC_GROW()
  color-words: change algorithm to allow for 0-character word boundaries
  color-words: take an optional regular expression describing words
  revision walker: include a detached HEAD in --all
  Fix parsing of @{-1}@{1}
  rebase -i --root: fix check for number of arguments

Johannes Sixt (1):
  Windows: Fix intermittent failures of t7701

Junio C Hamano (10):
  checkout: implement "@{-N}" shortcut name for N-th last branch
  bundle: allow the same ref to be given more than once
  interpret_nth_last_branch(): avoid traversing the reflog twice
  Fix reflog parsing for a malformed branch switching entry
  interpret_nth_last_branch(): plug small memleak
  Introduce for_each_recent_reflog_ent().
  Simplify parsing branch switching events in reflog
  http-push.c: style fixes
  rebase -i: correctly remember --root flag across --continue
  tests: Avoid single-shot environment export for shell function invocation

Kjetil Barvik (5):
  lstat_cache(): more cache effective symlink/directory detection
  lstat_cache(): introduce has_symlink_or_noent_leading_path() function
  lstat_cache(): introduce has_dirs_only_path() function
  lstat_cache(): introduce invalidate_lstat_cache() function
  lstat_cache(): introduce clear_lstat_cache() function

Miklos Vajna (1):
  gittutorial: remove misleading note

Nanako Shiraishi (1):
  Mention "local convention" rule in the CodingGuidelines

Serge van den Boom (1):
  Makefile: Make 'configure --with-expat=path' actually work

Sverre Rabbelier (1):
  Allow cloning an empty repository

Ted Pavlic (1):
  make: Remove -pthread on Darwin (it is included by cstdlib).

Teemu Likonen (1):
  diff-options.txt: Fix asciidoc markup issue

Thomas Rast (7):
  color-words: enable REG_NEWLINE to help user
  color-words: expand docs with precise semantics
  color-words: make regex configurable via attributes
  sha1_name: tweak @{-N} lookup
  sha1_name: support @{-N} syntax in get_sha1()
  checkout: implement "-" abbreviation, add docs and tests
  t1505: remove debugging cruft

Vitaly \"_Vi\" Shukela (3):
  git-svn: add --ignore-paths option for fetching
  git-svn: documented --ignore-paths
  git-svn: Add test for --ignore-paths parameter

^ permalink raw reply

* Re: Valgrind updates
From: Linus Torvalds @ 2009-01-29  1:56 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: zlib, valgrind-users, Mark Brown, Jeff King, Junio C Hamano,
	Git Mailing List
In-Reply-To: <alpine.DEB.1.00.0901272241250.14855@racer>



On Tue, 27 Jan 2009, Johannes Schindelin wrote:
> 
> To help ye Gods, I put together this almost minimal C program:

This one is buggy.

> 	out = fopen("/dev/null", "w");
> 	fwrite(compressed + 51, 51, 1, out);
> 	fwrite(compressed + 51, 1, 1, stderr);
> 	fflush(out);
> 	fclose(out);

The problem is that the first argument to that first "fwrite()" is simply 
wrong. It shouldn't be "compressed + 51", it should be just "compressed". 
As it is, you're writing 51 bytes, starting at 51 bytes in, and that's 
obviously not correct (you only got 58 bytes from deflate()).

So valgrind does complain about it, but for a perfectly valid reason.

So I think your minimal C program isn't actually showing what you wanted 
to show, and isn't showing the behaviour you see in git.

			Linus

^ permalink raw reply

* Re: do you recommend "git" (over svn) for a 1-person team???
From: david @ 2009-01-29  2:57 UTC (permalink / raw)
  To: Greg Hauptmann; +Cc: git
In-Reply-To: <d30068860901281725t14d19c1vc0557182bca3eb8d@mail.gmail.com>

On Thu, 29 Jan 2009, Greg Hauptmann wrote:

> Hi,
>
> Do you recommend "git" (over svn) for a 1-person team???   (the
> ability to commit whilst offline on my laptop sounds potentially
> enough reason)

well, if you use svn just put the svn repository on your laptop.

but if you use multiple systems you aren't really a 1-person team, you 
just happen to be one person working in different places.

also the distributed nature of git will make doing (and maintaining) 
backups easier, as well as recovering from the inevitable cases where you 
do development seperatly on your different machines and then need to 
combine them.

David Lang

^ permalink raw reply

* Re: [PATCH] builtin-apply.c: do not set bogus mode in check_preimage() for deleted path
From: Don Zickus @ 2009-01-29  1:46 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Alexander Potashev
In-Reply-To: <7vocxrj9j9.fsf@gitster.siamese.dyndns.org>

On Wed, Jan 28, 2009 at 03:27:54PM -0800, Junio C Hamano wrote:
>    Also I suspect this codepath has been broken the use case 7a07841
>    (git-apply: handle a patch that touches the same path more than once
>    better, 2008-06-27) wanted to support, and if that is the case, this
>    would fix it.

Actually deleting patches weren't that interesting to me, I deal more with
patches modifying the same patch repeatedly.  Regardless the patch below
seems ok to me.

Acked-by: Don Zickus <dzickus@redhat.com>

> 
>  builtin-apply.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/builtin-apply.c b/builtin-apply.c
> index b415daf..1e7f917 100644
> --- a/builtin-apply.c
> +++ b/builtin-apply.c
> @@ -2453,7 +2453,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s
>  	if (st_mode != patch->old_mode)
>  		fprintf(stderr, "warning: %s has type %o, expected %o\n",
>  			old_name, st_mode, patch->old_mode);
> -	if (!patch->new_mode)
> +	if (!patch->new_mode && !patch->is_delete)
>  		patch->new_mode = st_mode;
>  	return 0;
>  
> -- 
> 1.6.1.1.278.g6a817
> 

^ permalink raw reply

* Re: do you recommend "git" (over svn) for a 1-person team???
From: Sverre Rabbelier @ 2009-01-29  1:38 UTC (permalink / raw)
  To: Greg Hauptmann; +Cc: git
In-Reply-To: <d30068860901281725t14d19c1vc0557182bca3eb8d@mail.gmail.com>

Heya,

On Thu, Jan 29, 2009 at 02:25, Greg Hauptmann
<greg.hauptmann.ruby@gmail.com> wrote:
> Do you recommend "git" (over svn) for a 1-person team???   (the
> ability to commit whilst offline on my laptop sounds potentially
> enough reason)

Are you seriously asking if you should git instead of svn on the git
mailing list, or am I missing something? :P.

Seriously though, yes, git works very nicely for 1-person teams as
well as for large teams. Especially the ability to "git init && git
add . && git commit -m 'got part of the assignment done'" has helped
me a lot.
Before I started using git I would come to the point where I thought
'ah, good, it almost works, now all I have to do is add feature x, and
then 10 minutes later I'd be wishing I had used some form of revision
control so I could go back to that working version!

</testemonial>

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply

* Re: do you recommend "git" (over svn) for a 1-person team???
From: Greg Hauptmann @ 2009-01-29  1:25 UTC (permalink / raw)
  To: git
In-Reply-To: <d30068860901281718x363348caya2dc94e798cc8091@mail.gmail.com>

Hi,

Do you recommend "git" (over svn) for a 1-person team???   (the
ability to commit whilst offline on my laptop sounds potentially
enough reason)

Tks

^ permalink raw reply

* Git SVN fetch failing on large commit
From: Andrew Selder @ 2009-01-29  1:24 UTC (permalink / raw)
  To: git

Hi,

I'm trying to import an SVN repository and I'm running into trouble on a huge
SVN revision.

One of the revisions in SVN has a 1.25 GB file. When the git svn fetch process
gets to this revision, it crashed with the following message:

fatal: Out of memory, malloc failed
hash-object -w --stdin-paths: command returned error: 128

error closing pipe: Bad file descriptor at /usr/local/libexec/git-core//git-svn
line 0
error closing pipe: Bad file descriptor at /usr/local/libexec/git-core//git-svn
line 0

This is running on a machine with 3 GB of memory (2.5 GB free before starting
git svn), Git 1.6.1, Git-svn 1.6.1(svn 1.5.1)

Help would be greatly appreciated.

^ permalink raw reply

* git reset --merge misdocumented?
From: Johannes Schindelin @ 2009-01-29  1:17 UTC (permalink / raw)
  To: git

Hi,

from the man page I thought that --merge would be just another way to say 
"git read-tree -u -m".

In particular, the man page says _nothing_ about resetting HEAD to 
something else.

Maybe somebody with l33ter dox skillz than me would like to fix that.

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH/RFC v1 5/6] combine-diff.c: remove a call to fstat() inside show_patch_diff()
From: Junio C Hamano @ 2009-01-29  1:16 UTC (permalink / raw)
  To: Kjetil Barvik; +Cc: git
In-Reply-To: <7v63jznp58.fsf@gitster.siamese.dyndns.org>

Junio C Hamano <gitster@pobox.com> writes:

> Kjetil Barvik <barvik@broadpark.no> writes:
>
>> Currently inside show_patch_diff() we have and fstat() call after an
>> ok lstat() call.  Since we before the call to fstat() have already
>> test for the link case with S_ISLNK() the fstat() can be removed.
>
> Good eyes.  Thanks.

Heh, I noticed you will update the commit log message, so I'll dequeue
this and wait for an update.

^ permalink raw reply

* Re: Valgrind updates
From: Mark Adler @ 2009-01-29  0:15 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Linus Torvalds, Jean-loup Gailly, Mark Brown, Jeff King,
	Junio C Hamano, Git Mailing List
In-Reply-To: <alpine.DEB.1.00.0901290024290.3586@pacific.mpi-cbg.de>

On Jan 28, 2009, at 3:27 PM, Johannes Schindelin wrote:
> On Wed, 28 Jan 2009, Mark Adler wrote:
>> 2.  Can someone send me the input and the 58 bytes of output from  
>> this
>>   case?
>
> I did better than that already...
> http://article.gmane.org/gmane.comp.version-control.git/107391

Johannes,

Thanks for the input and code.  When I run it, the byte in question at  
offset 51 is 0x2c.  The output decompresses fine and the result  
matches the input.  If I change the 0x2c to anything else,  
decompression fails.  The 58 bytes are below.

Can you also send me the 58 bytes of output that you get when you run  
it?  Thanks.

Mark



78 01 2b 29 4a 4d 55 30 34 33 65 30 34 30 30 33
31 51 48 cb cc 49 35 64 10 60 c0 04 48 0a 8c 18
14 30 e5 91 4d 30 66 30 c0 af c0 84 c1 01 bf 02
53 86 00 2c 0a 00 86 79 13 07

^ permalink raw reply

* Re: [PATCH] add -u: do not fail to resolve a path as deleted
From: Junio C Hamano @ 2009-01-29  0:13 UTC (permalink / raw)
  To: git
In-Reply-To: <7viqnzj9ay.fsf@gitster.siamese.dyndns.org>

Junio C Hamano <gitster@pobox.com> writes:

> This is wrong; breaks t3702.

Ugh; that is a bogus test.  Please disregard.

^ permalink raw reply

* Re: "malloc failed"
From: David Abrahams @ 2009-01-29  0:06 UTC (permalink / raw)
  To: Jeff King; +Cc: git
In-Reply-To: <c26bbb3fe074f6f6e0634a4ae8611239@206.71.190.141>


on Wed Jan 28 2009, David Abrahams <dave-AT-boostpro.com> wrote:

> On Wed, 28 Jan 2009 00:02:25 -0500, Jeff King <peff@peff.net> wrote:
>> On Tue, Jan 27, 2009 at 10:04:42AM -0500, David Abrahams wrote:
>> 
>>> I've been abusing Git for a purpose it wasn't intended to serve:
>>> archiving a large number of files with many duplicates and
>>> near-duplicates.  Every once in a while, when trying to do something
>>> really big, it tells me "malloc failed" and bails out (I think it's
>>> during "git add" but because of the way I issued the commands I can't
>>> tell: it could have been a commit or a gc).  This is on a 64-bit linux
>>> machine with 8G of ram and plenty of swap space, so I'm surprised.
>>> 
>>> Git is doing an amazing job at archiving and compressing all this stuff
>>> I'm putting in it, but I have to do it a wee bit at a time or it craps
>>> out.  Bug?
>> 
>> How big is the repository? How big are the biggest files? I have a
>> 3.5G repo with files ranging from a few bytes to about 180M. I've never
>> run into malloc problems or gone into swap on my measly 1G box.
>> How does your dataset compare?
>
> I'll try to do some research.  Gotta go pick up my boy now...

Well, moving the 2.6G .dar backup binary out of the fileset seems to
have helped a little, not surprisingly :-P

I don't know whether anyone on this list should care about that failure
given the level of abuse I'm inflicting on Git, but keep in mind that
the system *does* have 8G of memory.  Conclude what you will from that,
I suppose!

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

^ permalink raw reply

* Re: [PATCH] add -u: do not fail to resolve a path as deleted
From: Junio C Hamano @ 2009-01-28 23:32 UTC (permalink / raw)
  To: git
In-Reply-To: <7vbptrkqvb.fsf@gitster.siamese.dyndns.org>

Junio C Hamano <gitster@pobox.com> writes:

> After you resolve a conflicted merge to remove the path, "git add -u"
> failed to record the removal.  Instead it errored out by saying that the
> removed path is not found in the work tree, but that is what the user
> wanted to do and failing it is illogical.
>
> This fixes it.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>  read-cache.c          |    5 +++++
>  t/t2200-add-update.sh |   20 +++++++++++++++++++-
>  2 files changed, 24 insertions(+), 1 deletions(-)
>
> diff --git a/read-cache.c b/read-cache.c
> index b1475ff..ddc0586 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -1574,6 +1574,11 @@ static void update_callback(struct diff_queue_struct *q,
>  		default:
>  			die("unexpected diff status %c", p->status);
>  		case DIFF_STATUS_UNMERGED:
> +			/*
> +			 * diff-files gives U followed by the work tree state
> +			 * such as M or D, so we can ignore this.
> +			 */
> +			continue;

This is wrong; breaks t3702.

^ permalink raw reply

* Re: How to install and use a custom merge driver
From: Alec Clews @ 2009-01-28 23:31 UTC (permalink / raw)
  To: git
In-Reply-To: <loom.20090128T230123-889@post.gmane.org>

Alec Clews <alecclews <at> gmail.com> writes:

> Is there someway to enable logging to see how git is making this choice?


Found the answer to my question.

GIT_MERGE_VERBOSITY=5
GIT_TRACE=true


Which results in

+ git merge --stat del2
trace: built-in: git 'merge' '--stat' 'del2'
Merging:
38f3eb9 Accepting delivery del1
virtual del2
found 1 common ancestor(s):
af9dc93 Creating empty staging repo
Auto-merging src/main.c
CONFLICT (add/add): Merge conflict in src/main.c
Automatic merge failed; fix conflicts and then commit the result.


So I'm none the wiser :-(. Any suggestions from wiser people than I?

Thanks

-Alec

^ permalink raw reply

* [PATCH] builtin-apply.c: do not set bogus mode in check_preimage() for deleted path
From: Junio C Hamano @ 2009-01-28 23:27 UTC (permalink / raw)
  To: git; +Cc: Don Zickus, Alexander Potashev

If it is deleted, it is deleted.  Do not set the current mode to it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * This updates 1f7903a (builtin-apply: prevent non-explicit permission
   changes, 2009-01-02).  It should not change the behaviour in the normal
   case, because we do not explicitly check the final mode of a deletion
   patch.  We do check the deletion patch creates an empty result, and we
   might want to fix that someday, and at that point the existing code
   will break.

   Also I suspect this codepath has been broken the use case 7a07841
   (git-apply: handle a patch that touches the same path more than once
   better, 2008-06-27) wanted to support, and if that is the case, this
   would fix it.

 builtin-apply.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin-apply.c b/builtin-apply.c
index b415daf..1e7f917 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -2453,7 +2453,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s
 	if (st_mode != patch->old_mode)
 		fprintf(stderr, "warning: %s has type %o, expected %o\n",
 			old_name, st_mode, patch->old_mode);
-	if (!patch->new_mode)
+	if (!patch->new_mode && !patch->is_delete)
 		patch->new_mode = st_mode;
 	return 0;
 
-- 
1.6.1.1.278.g6a817

^ permalink raw reply related

* Re: Valgrind updates
From: Johannes Schindelin @ 2009-01-28 23:27 UTC (permalink / raw)
  To: Mark Adler
  Cc: Linus Torvalds, Jean-loup Gailly, Mark Brown, Jeff King,
	Junio C Hamano, Git Mailing List
In-Reply-To: <69A01114-27BB-4239-8FD8-C35D1306CE25@alumni.caltech.edu>

Hi,

On Wed, 28 Jan 2009, Mark Adler wrote:

> 2.  Can someone send me the input and the 58 bytes of output from this 
>    case?

I did better than that already... 
http://article.gmane.org/gmane.comp.version-control.git/107391

Maybe it did not go through correctly.

Unfortunately, I was sick today and could not do any proper work, so I 
could not even test the suggestions Julian gave me.

The easiest test, though, should be to set the byte at offset 51 to 
something bogus and see if inflate() still groks it.

Ciao,
Dscho

^ permalink raw reply

* Re: Valgrind updates
From: Mark Adler @ 2009-01-28 23:06 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Johannes Schindelin, Jean-loup Gailly, Mark Brown, Jeff King,
	Junio C Hamano, Git Mailing List
In-Reply-To: <alpine.LFD.2.00.0901271006060.3123@localhost.localdomain>

On Jan 27, 2009, at 10:55 AM, Linus Torvalds wrote:
> and valgrind complains that the "write_buffer()" call will touch an
> uninitialized byte (just one byte, and in the _middle_ of the  
> buffer, no
> less):

Linus,

That is definitely not deflate's intentional use of uninitialized  
bytes that is noted in the zlib FAQ.  This is something else.

> Maybe the zlib people can tell us that we're idiots and the above is
> buggy, but maybe there is a real bug in zlib.

I can't speak to the idiot part, but your usage of deflate is not  
buggy.  (At least assuming that NULL is all zeros for the compiler in  
use.)

If this is all correct, it sounds like a serious bug in deflate.  If  
so, it would have to be a very sneaky bug to not have been discovered  
over the last decade or so of deflate usage on who knows how many  
zettabytes of data.  The deflate code has remained largely unchanged  
in that time, and there really isn't anything unusual about your usage.

I have some questions:

1.  Is this problem reproducible on more than one machine?

2.  Can someone send me the input and the 58 bytes of output from this  
case?

3.  Did you try decompressing the 58 bytes?

4.  For the detection of an "uninitialized byte", if for example an  
uninitialized byte is copied to another location, is that location  
then also considered uninitialized?  Or does uninitialized mean that  
that location has really never been written to?

5.  Would the access of uninitialized bytes by deflate have been  
detected?  Since I don't see a mention of uninitialized access before  
the write_buffer(), does that mean that deflate never did such a thing  
itself?

Mark

^ permalink raw reply

* Re: How to install and use a custom merge driver
From: Alec Clews @ 2009-01-28 23:04 UTC (permalink / raw)
  To: git
In-Reply-To: <20090128061848.GA19165@coredump.intra.peff.net>

Jeff King <peff <at> peff.net> writes:
> On Wed, Jan 28, 2009 at 02:10:18PM +1100, Alec Clews wrote:
> 
> > Setup:
> >
> > I have set up my ..git/info/gitattributes as follows
> >
> > *      merge=overwrite
> 
> Your setup looks right, except that the correct file is
> ".git/info/attributes".

Thanks Jeff

I fixed that problem -- however it did not make any difference.

Is there someway to enable logging to see how git is making this choice?

- Alec

^ permalink raw reply

* [StGit PATCH] Check for local changes with "goto"
From: Catalin Marinas @ 2009-01-28 23:13 UTC (permalink / raw)
  To: Karl Hasselström; +Cc: git

This is done by default, unless the --keep option is passed, for
consistency with the "pop" command. The index is checked in the
Transaction.run() function so that other commands could benefit from
this feature (off by default).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
 stgit/commands/goto.py    |    8 ++++++--
 stgit/lib/transaction.py  |    7 ++++++-
 t/t2300-refresh-subdir.sh |    2 +-
 t/t2800-goto-subdir.sh    |    4 ++--
 t/t3000-dirty-merge.sh    |    2 +-
 5 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/stgit/commands/goto.py b/stgit/commands/goto.py
index 60a917e..7c5ad39 100644
--- a/stgit/commands/goto.py
+++ b/stgit/commands/goto.py
@@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 from stgit.commands import common
 from stgit.lib import transaction
 from stgit import argparse
+from stgit.argparse import opt
 
 help = 'Push or pop patches to the given one'
 kind = 'stack'
@@ -27,7 +28,10 @@ Push/pop patches to/from the stack until the one given on the command
 line becomes current."""
 
 args = [argparse.other_applied_patches, argparse.unapplied_patches]
-options = []
+options = [
+    opt('-k', '--keep', action = 'store_true',
+        short = 'Keep the local changes')
+]
 
 directory = common.DirectoryHasRepositoryLib()
 
@@ -52,4 +56,4 @@ def func(parser, options, args):
         raise common.CmdException('Cannot goto a hidden patch')
     else:
         raise common.CmdException('Patch "%s" does not exist' % patch)
-    return trans.run(iw)
+    return trans.run(iw, check_clean = not options.keep)
diff --git a/stgit/lib/transaction.py b/stgit/lib/transaction.py
index 54de127..2b8f2de 100644
--- a/stgit/lib/transaction.py
+++ b/stgit/lib/transaction.py
@@ -183,13 +183,18 @@ class StackTransaction(object):
             self.__checkout(self.__stack.head.data.tree, iw,
                             allow_bad_head = True)
     def run(self, iw = None, set_head = True, allow_bad_head = False,
-            print_current_patch = True):
+            print_current_patch = True, check_clean = False):
         """Execute the transaction. Will either succeed, or fail (with an
         exception) and do nothing."""
         self.__check_consistency()
         log.log_external_mods(self.__stack)
         new_head = self.head
 
+        # Check for not clean index
+        if check_clean and iw and not iw.index.is_clean():
+            self.__halt('Repository not clean. Use "refresh" or '
+                        '"status --reset"')
+
         # Set branch head.
         if set_head:
             if iw:
diff --git a/t/t2300-refresh-subdir.sh b/t/t2300-refresh-subdir.sh
index d731a11..89c95db 100755
--- a/t/t2300-refresh-subdir.sh
+++ b/t/t2300-refresh-subdir.sh
@@ -65,7 +65,7 @@ test_expect_success 'refresh -u -p <subdir>' '
 
 test_expect_success 'refresh an unapplied patch' '
     stg refresh -u &&
-    stg goto p0 &&
+    stg goto --keep p0 &&
     test "$(stg status)" = "M foo.txt" &&
     stg refresh -p p1 &&
     test "$(stg status)" = "" &&
diff --git a/t/t2800-goto-subdir.sh b/t/t2800-goto-subdir.sh
index 28b8292..855972b 100755
--- a/t/t2800-goto-subdir.sh
+++ b/t/t2800-goto-subdir.sh
@@ -25,7 +25,7 @@ cat > expected2.txt <<EOF
 bar
 EOF
 test_expect_success 'Goto in subdirectory (just pop)' '
-    (cd foo && stg goto p1) &&
+    (cd foo && stg goto --keep p1) &&
     cat foo/bar > actual.txt &&
     test_cmp expected1.txt actual.txt &&
     ls foo > actual.txt &&
@@ -48,7 +48,7 @@ cat > expected2.txt <<EOF
 bar
 EOF
 test_expect_success 'Goto in subdirectory (conflicting push)' '
-    (cd foo && stg goto p3) ;
+    (cd foo && stg goto --keep p3) ;
     [ $? -eq 3 ] &&
     cat foo/bar > actual.txt &&
     test_cmp expected1.txt actual.txt &&
diff --git a/t/t3000-dirty-merge.sh b/t/t3000-dirty-merge.sh
index f0f79d5..419d86e 100755
--- a/t/t3000-dirty-merge.sh
+++ b/t/t3000-dirty-merge.sh
@@ -26,7 +26,7 @@ test_expect_success 'Push with dirty worktree' '
     echo 4 > a &&
     [ "$(echo $(stg series --applied --noprefix))" = "p1" ] &&
     [ "$(echo $(stg series --unapplied --noprefix))" = "p2" ] &&
-    conflict stg goto p2 &&
+    conflict stg goto --keep p2 &&
     [ "$(echo $(stg series --applied --noprefix))" = "p1" ] &&
     [ "$(echo $(stg series --unapplied --noprefix))" = "p2" ] &&
     [ "$(echo $(cat a))" = "4" ]

^ permalink raw reply related

* Re: [PATCH] http-push: refactor request url creation
From: Johannes Schindelin @ 2009-01-28 23:06 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Tay Ray Chuan, git
In-Reply-To: <7vvdrzjb80.fsf@gitster.siamese.dyndns.org>

Hi,

On Wed, 28 Jan 2009, Junio C Hamano wrote:

> I thought at least you did not have these overlong lines in your earlier 
> attempts, and Dscho may have acked one of those, but I doubt he would 
> give his Ack to this one.  I certainly wouldn't Ack it myself.

My understanding is that the ACK is sent to the mailing list by the Acker 
and in response to the particular patch she is Acking.

> The refactoring looked sane otherwise, but I think we would want to opt 
> for safety by keeping an extra string around.

Yep.  Better safe 'n sorry.

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH] http-push: refactor request url creation
From: Junio C Hamano @ 2009-01-28 22:51 UTC (permalink / raw)
  To: Tay Ray Chuan; +Cc: git, Johannes Schindelin
In-Reply-To: <4980D9FF.7020307@gmail.com>

Tay Ray Chuan <rctay89@gmail.com> writes:

> Currently, functions that deal with objects on the remote repository have to allocate and do strcpys to generate the URL.
>
> This patch saves them this trouble, by providing two functions, "append_remote_object_url" and "get_remote_object_url".
>
> Both generate a URL, with either the object's 2-digit hex directory (eg. /objects/a1/), or the complete object location (eg. /objects/a1/b2).
>
> However, they differ in that "append_remote_object_url" appends this URL to a strbuf, while "get_remote_object_url" wraps around the former and returns the URL directly in char*. Users usually would use "get_remote_object_url", but may find "append_remote_object_url" useful if they require further string operations on the URL.
>
> PS. In "start_fetch_loose", the variable "url" which is passed to "curl_easy_setopt" is removed, and in its place "request->url" is used. This is safe, since curl strdup's it.
>
> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> Acked-by: Junio C Hamano <gitster@pobox.com>

What's with these loooooooooooooooooooooooooooooong lines?

I thought at least you did not have these overlong lines in your earlier
attempts, and Dscho may have acked one of those, but I doubt he would give
his Ack to this one.  I certainly wouldn't Ack it myself.

By the way, aren't you sending format="flowed"?  Please don't.  It damages
whitespaces.

Daniel Stenberg did a research on the safety of your "since curl stdrup's
it" claim, and found that it unsafe for earlier versions of the library
before 7.17.0.

It seems that we earlier found out that anything older than 7.16 were not
usable for git-http-push (see Release Notes for 1.5.4), but 7.16 is still
older than 7.17, so either we declare you _must_ have 7.17 or newer to use
http-push, or keep an extra copy around and free it later like the
original code does.

Even Debian is at 7.18.2 these days, so requiring 7.17 or newer may not be
an issue in practice, but there are people who keep running things on
older distros with proven stability (and known features limitation).

The refactoring looked sane otherwise, but I think we would want to opt
for safety by keeping an extra string around.

Thanks.

^ permalink raw reply

* Re: (beginner) git rm
From: Junio C Hamano @ 2009-01-28 22:33 UTC (permalink / raw)
  To: Björn Steinbrink; +Cc: Zabre, git
In-Reply-To: <20090128221355.GE7503@atjola.homenet>

Björn Steinbrink <B.Steinbrink@gmx.de> writes:

> With "checkout", I'm still a bit unsure about which term to use, because
> of the behaviour you get with, for example, "git checkout HEAD --
> directory".
> ...
> It would probably be better to say that checkout only works with the
> blobs (because the index doesn't have entries for trees, right?).

True, it is not just "checkout".  There is no such thing as "directory" in
git UI, in that sense.

When you say:

	git checkout [<tree-ish>] -- pathspec

you may be using the same string as the name of an existing directory, but
that does not change the fact that you are giving a pathspec pattern to
specify the set of paths in the index (or in the <tree-ish>) that matches
the pathspec.

^ permalink raw reply

* [PATCH] add -u: do not fail to resolve a path as deleted
From: Junio C Hamano @ 2009-01-28 22:28 UTC (permalink / raw)
  To: git

After you resolve a conflicted merge to remove the path, "git add -u"
failed to record the removal.  Instead it errored out by saying that the
removed path is not found in the work tree, but that is what the user
wanted to do and failing it is illogical.

This fixes it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 read-cache.c          |    5 +++++
 t/t2200-add-update.sh |   20 +++++++++++++++++++-
 2 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/read-cache.c b/read-cache.c
index b1475ff..ddc0586 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1574,6 +1574,11 @@ static void update_callback(struct diff_queue_struct *q,
 		default:
 			die("unexpected diff status %c", p->status);
 		case DIFF_STATUS_UNMERGED:
+			/*
+			 * diff-files gives U followed by the work tree state
+			 * such as M or D, so we can ignore this.
+			 */
+			continue;
 		case DIFF_STATUS_MODIFIED:
 		case DIFF_STATUS_TYPE_CHANGED:
 			if (add_file_to_index(&the_index, path, data->flags)) {
diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh
index cd9231c..e917a01 100755
--- a/t/t2200-add-update.sh
+++ b/t/t2200-add-update.sh
@@ -12,7 +12,7 @@ and issues a git add -u with path limiting on "dir" to add
 only the updates to dir/sub.
 
 Also tested are "git add -u" without limiting, and "git add -u"
-without contents changes.'
+without contents changes, and other conditions'
 
 . ./test-lib.sh
 
@@ -128,4 +128,22 @@ test_expect_success 'add -n -u should not add but just report' '
 
 '
 
+test_expect_success 'add -u resolves unmerged paths' '
+	git reset --hard &&
+	one=$(echo 1 | git hash-object -w --stdin) &&
+	two=$(echo 2 | git hash-object -w --stdin) &&
+	three=$(echo 3 | git hash-object -w --stdin) &&
+	for path in path1 path2
+	do
+		echo "100644 $one 1	$path"
+		echo "100644 $two 2	$path"
+		echo "100644 $three 3	$path"
+	done |
+	git update-index --index-info &&
+	echo 4 >path1 &&
+	git add -u &&
+	test 1 = "$(git ls-files path1 path2 | wc -l)"
+'
+
 test_done
+
-- 
1.6.1.1.278.g6a817

^ permalink raw reply related

* [PATCH] http-push: refactor request url creation
From: Tay Ray Chuan @ 2009-01-28 22:19 UTC (permalink / raw)
  To: git, Johannes Schindelin, Junio C Hamano

Currently, functions that deal with objects on the remote repository have to allocate and do strcpys to generate the URL.

This patch saves them this trouble, by providing two functions, "append_remote_object_url" and "get_remote_object_url".

Both generate a URL, with either the object's 2-digit hex directory (eg. /objects/a1/), or the complete object location (eg. /objects/a1/b2).

However, they differ in that "append_remote_object_url" appends this URL to a strbuf, while "get_remote_object_url" wraps around the former and returns the URL directly in char*. Users usually would use "get_remote_object_url", but may find "append_remote_object_url" useful if they require further string operations on the URL.

PS. In "start_fetch_loose", the variable "url" which is passed to "curl_easy_setopt" is removed, and in its place "request->url" is used. This is safe, since curl strdup's it.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Junio C Hamano <gitster@pobox.com>
---

* renamed only_two_digit_postfix in original patch to only_two_digit_prefix
* rebased and generated on master (5dc1308)
* updated with Junio's changes (if (...) and fix memory leak)
* updated with Junio's double interface
* rebased and generated on master (297f6a5)

  http-push.c |   64 +++++++++++++++++++++++-----------------------------------
  1 files changed, 25 insertions(+), 39 deletions(-)

diff --git a/http-push.c b/http-push.c
index 59037df..6511d19 100644
--- a/http-push.c
+++ b/http-push.c
@@ -209,6 +209,20 @@ static struct curl_slist *get_dav_token_headers(struct remote_lock *lock, enum d
  	return dav_headers;
  }

+static void append_remote_object_url(struct strbuf *buf, const char *url, const char *hex, int only_two_digit_prefix)
+{
+	strbuf_addf(buf, "%sobjects/%.*s/", url, 2, hex);
+	if (!only_two_digit_prefix)
+		strbuf_addf(buf, "%s", hex+2);
+}
+
+static char *get_remote_object_url(const char *url, const char *hex, int only_two_digit_prefix)
+{
+	struct strbuf buf = STRBUF_INIT;
+	append_remote_object_url(&buf, url, hex, only_two_digit_prefix);
+	return strbuf_detach(&buf, NULL);
+}
+
  static void finish_request(struct transfer_request *request);
  static void release_request(struct transfer_request *request);

@@ -254,8 +268,6 @@ static void start_fetch_loose(struct transfer_request *request)
  	char *hex = sha1_to_hex(request->obj->sha1);
  	char *filename;
  	char prevfile[PATH_MAX];
-	char *url;
-	char *posn;
  	int prevlocal;
  	unsigned char prev_buf[PREV_BUF_SIZE];
  	ssize_t prev_read = 0;
@@ -305,17 +317,7 @@ static void start_fetch_loose(struct transfer_request *request)

  	git_SHA1_Init(&request->c);

-	url = xmalloc(strlen(remote->url) + 50);
-	request->url = xmalloc(strlen(remote->url) + 50);
-	strcpy(url, remote->url);
-	posn = url + strlen(remote->url);
-	strcpy(posn, "objects/");
-	posn += 8;
-	memcpy(posn, hex, 2);
-	posn += 2;
-	*(posn++) = '/';
-	strcpy(posn, hex + 2);
-	strcpy(request->url, url);
+	request->url = get_remote_object_url(remote->url, hex, 0);

  	/* If a previous temp file is present, process what was already
  	   fetched. */
@@ -359,7 +361,7 @@ static void start_fetch_loose(struct transfer_request *request)
  	curl_easy_setopt(slot->curl, CURLOPT_FILE, request);
  	curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_sha1_file);
  	curl_easy_setopt(slot->curl, CURLOPT_ERRORBUFFER, request->errorstr);
-	curl_easy_setopt(slot->curl, CURLOPT_URL, url);
+	curl_easy_setopt(slot->curl, CURLOPT_URL, request->url);
  	curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, no_pragma_header);

  	/* If we have successfully processed data from a previous fetch
@@ -388,16 +390,8 @@ static void start_mkcol(struct transfer_request *request)
  {
  	char *hex = sha1_to_hex(request->obj->sha1);
  	struct active_request_slot *slot;
-	char *posn;

-	request->url = xmalloc(strlen(remote->url) + 13);
-	strcpy(request->url, remote->url);
-	posn = request->url + strlen(remote->url);
-	strcpy(posn, "objects/");
-	posn += 8;
-	memcpy(posn, hex, 2);
-	posn += 2;
-	strcpy(posn, "/");
+	request->url = get_remote_object_url(remote->url, hex, 1);

  	slot = get_active_slot();
  	slot->callback_func = process_response;
@@ -512,7 +506,7 @@ static void start_put(struct transfer_request *request)
  {
  	char *hex = sha1_to_hex(request->obj->sha1);
  	struct active_request_slot *slot;
-	char *posn;
+	struct strbuf buf = STRBUF_INIT;
  	enum object_type type;
  	char hdr[50];
  	void *unpacked;
@@ -551,21 +545,13 @@ static void start_put(struct transfer_request *request)

  	request->buffer.buf.len = stream.total_out;

-	request->url = xmalloc(strlen(remote->url) +
-			       strlen(request->lock->token) + 51);
-	strcpy(request->url, remote->url);
-	posn = request->url + strlen(remote->url);
-	strcpy(posn, "objects/");
-	posn += 8;
-	memcpy(posn, hex, 2);
-	posn += 2;
-	*(posn++) = '/';
-	strcpy(posn, hex + 2);
-	request->dest = xmalloc(strlen(request->url) + 14);
-	sprintf(request->dest, "Destination: %s", request->url);
-	posn += 38;
-	*(posn++) = '_';
-	strcpy(posn, request->lock->token);
+	strbuf_addstr(&buf, "Destination: ");
+	append_remote_object_url(&buf, remote->url, hex, 0);
+	request->dest = strbuf_detach(&buf, NULL);
+
+	append_remote_object_url(&buf, remote->url, hex, 0);
+	strbuf_addstr(&buf, request->lock->token);
+	request->url = strbuf_detach(&buf, NULL);

  	slot = get_active_slot();
  	slot->callback_func = process_response;
-- 
1.6.1.1.251.g0dfa1

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox