Allow monitor/unintersting objects to be null
PATCH 1/2 Allow monitor/unintersting objects to be null
--- .../src/org/spearce/jgit/lib/PackWriter.java | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java +3 -2
@@ -230,8 +230,8 @@ public PackWriter(final Repository repo, final ProgressMonitor monitor) { public PackWriter(final Repository repo, final ProgressMonitor imonitor, final ProgressMonitor wmonitor) { this.db = repo; - initMonitor = imonitor; - writeMonitor = wmonitor; + initMonitor = (imonitor == null ? new NullProgressMonitor() : imonitor); + writeMonitor = (wmonitor == null ? new NullProgressMonitor() : wmonitor); this.deflater = new Deflater(db.getConfig().getCore().getCompression()); outputVersion = repo.getConfig().getCore().getPackIndexVersion(); }
@@ -829,6 +829,7 @@ private ObjectWalk setUpWalker( RevObject o = walker.parseAny(id); walker.markStart(o); } + if (uninterestingObjects != null) for (ObjectId id : uninterestingObjects) { final RevObject o; try {
Signature · 1 line
1.6.2.2
PATCH 2/2 Use NullProgressMonitor.INSTANCE and indent for loop
--- .../src/org/spearce/jgit/lib/PackWriter.java | 25 ++++++++++--------- 1 files changed, 13 insertions(+), 12 deletions(-)
org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java +13 -12
@@ -230,8 +230,8 @@ public PackWriter(final Repository repo, final ProgressMonitor monitor) { public PackWriter(final Repository repo, final ProgressMonitor imonitor, final ProgressMonitor wmonitor) { this.db = repo; - initMonitor = (imonitor == null ? new NullProgressMonitor() : imonitor); - writeMonitor = (wmonitor == null ? new NullProgressMonitor() : wmonitor); + initMonitor = imonitor == null ? NullProgressMonitor.INSTANCE : imonitor; + writeMonitor = wmonitor == null ? NullProgressMonitor.INSTANCE : wmonitor; this.deflater = new Deflater(db.getConfig().getCore().getCompression()); outputVersion = repo.getConfig().getCore().getPackIndexVersion(); }
@@ -829,17 +829,18 @@ private ObjectWalk setUpWalker( RevObject o = walker.parseAny(id); walker.markStart(o); } - if (uninterestingObjects != null) - for (ObjectId id : uninterestingObjects) { - final RevObject o; - try { - o = walker.parseAny(id); - } catch (MissingObjectException x) { - if (ignoreMissingUninteresting) - continue; - throw x; + if (uninterestingObjects != null) { + for (ObjectId id : uninterestingObjects) { + final RevObject o; + try { + o = walker.parseAny(id); + } catch (MissingObjectException x) { + if (ignoreMissingUninteresting) + continue; + throw x; + } + walker.markUninteresting(o); } - walker.markUninteresting(o); } return walker; }
Signature · 1 line
1.6.2.2
Re: [PATCH 2/2] Use NullProgressMonitor.INSTANCE and indent for loop
Quoted 3 lines · Alex Blewitt
--- .../src/org/spearce/jgit/lib/PackWriter.java | 25 ++++++++++--------- 1 files changed, 13 insertions(+), 12 deletions(-)
Huh. These two should have been squashed together; see "git rebase -i HEAD~2" and its "squash" subcommand.
It looks fine otherwise. I'll squash here when I apply. Just keep it in mind for future reference.
Signature · 1 line
Shawn.
Re: [PATCH 2/2] Use NullProgressMonitor.INSTANCE and indent for loop
In reply to Alex BlewittQuoted 3 lines · Alex Blewitt
--- .../src/org/spearce/jgit/lib/PackWriter.java | 25 ++++++++++--------- 1 files changed, 13 insertions(+), 12 deletions(-)
Also, I'd like a Signed-off-by line for your patches. We follow Linux kernel tradition and use a Signed-off-by line to mean you agree to the "Developer's Certificate of Origin 1.1" (see SUBMITTING_PATCHES in the top level directory, part 5).
For the 2 that you've submitted thus far (this one, and the make private constructor) you can just reply to the email and drop the SOB line into the message body. In the future make sure you add it in with git commit -s or git format-patch -s prior to sending.
Signature · 1 line
Shawn.
Re: [PATCH 2/2] Use NullProgressMonitor.INSTANCE and indent for loop
I've been using git send-email --format-patch, which doesn't appear to add the signed by line. If I do it as the commit, will it add the signed-by when it gets committed, and thus I can use send-email? git format-patch just seems to dump a load of files into the directory, and (as noted elsewhere) the git-rebase doesn't appear to work for me.
Alex
Quoted 18 lines · Shawn O. Pearce
Quoted 4 lines · Alex Blewitt
---
.../src/org/spearce/jgit/lib/PackWriter.java | 25 +++++++++
+---------1 files changed, 13 insertions(+), 12 deletions(-)Also, I'd like a Signed-off-by line for your patches. We follow Linux kernel tradition and use a Signed-off-by line to mean you agree to the "Developer's Certificate of Origin 1.1" (see
SUBMITTING_PATCHESin the top level directory, part 5).For the 2 that you've submitted thus far (this one, and the make private constructor) you can just reply to the email and drop the SOB line into the message body. In the future make sure you add it in with git commit -s or git format-patch -s prior to sending.
Signature · 1 line
Shawn.
Re: [PATCH 2/2] Use NullProgressMonitor.INSTANCE and indent for loop
Quoted 5 lines · Alex Blewitt
I've been using git send-email --format-patch, which doesn't appear to add the signed by line. If I do it as the commit, will it add the signed-by when it gets committed, and thus I can use send-email? git format-patch just seems to dump a load of files into the directory, and (as noted elsewhere) the git-rebase doesn't appear to work for me.
IIRC, "git send-email --format-patch -- -s" would pass -s to the format-patch script, adding the line automatically. But that's an undocumented feature of send-email.
Personally, I put the SOB line in with "git commit -s" when I write the change. Then its there when I dump it out with format-patch.
As for format-patch making a ton of files, yea, that's its job. I actually use the following pair of scripts to manage sending, as this lets me edit _sop/OUT/* before firing it off.
--8<--
#!/bin/sh
if [ -n "$(git rev-parse --show-cdup)" ]; then
cd $(git rev-parse --show-cdup) || exit
fi
mkdir -p _sop/OUT &&
rm -f $(find _sop/OUT -name '*.patch' | grep -v '0000-cover-letter') && base="${1:-master}" &&
if [ $(git rev-list ^$base HEAD | wc -l) -gt 1 ]
then
n="--numbered --cover-letter" fi && git format-patch \ --output-directory _sop/OUT \ --subject-prefix='JGIT PATCH' \ -M \ $n \ $base || exit
----
--8<--
#!/bin/sh
if [ -n "$(git rev-parse --show-cdup)" ]; then
cd $(git rev-parse --show-cdup) || exit
fi
ls -1 _sop/OUT
read
git send-email \ --to 'Robin Rosenberg <[email protected]>' \ --cc '[email protected]' \ --chain-reply-to \ --suppress-cc self \ --smtp-server localhost \ --smtp-server-port 8025 \ _sop/OUT
----
Signature · 1 line
Shawn.
Besides all comments by Shawn. Please set the prefix to EGIT PATCH or JGIT PATCH so the C Git people that are not interested in JGit know this isn't for them.
If you add this to your .git/config you will get the prefix automagically when generating the patches.
[format]
subjectprefix = EGIT PATCH
-- robin
Thanks Robin, that's great. I did attempt to set the subject on git send-mail --subject, but unfortunately it had no impact; note the 'Subject' on the line.
It works if I configure the .gitconfig though. I'll do that in the future.
apple:egit alex$ git send-email origin/master --subject "Fooooooooo" --dry-run (mbox) Adding cc: Alex Blewitt <[email protected]> from line 'From: Alex Blewitt <[email protected]>'
Dry-OK. Log says:
Sendmail: /usr/sbin/sendmail -i [email protected]
From: Alex Blewitt <[email protected]>
To:
Cc: Alex Blewitt <[email protected]>
Subject: [PATCH 1/3] Allow monitor/unintersting objects to be null
Date: Wed, 6 May 2009 22:26:05 +0100
Message-Id: <[email protected]>
X-Mailer: git-send-email 1.6.2.2
Result: OK
(mbox) Adding cc: Alex Blewitt <[email protected]> from line 'From: Alex Blewitt <[email protected]>'
Dry-OK. Log says:
Sendmail: /usr/sbin/sendmail -i [email protected]
From: Alex Blewitt <[email protected]>
To:
Cc: Alex Blewitt <[email protected]>
Subject: [PATCH 2/3] Use NullProgressMonitor.INSTANCE and indent for loop
Date: Wed, 6 May 2009 22:26:06 +0100
Message-Id: <[email protected]>
X-Mailer: git-send-email 1.6.2.2
In-Reply-To: <[email protected]>
References: <[email protected]>
Result: OK
(mbox) Adding cc: Alex Blewitt <[email protected]> from line 'From: Alex Blewitt <[email protected]>'
Dry-OK. Log says:
Sendmail: /usr/sbin/sendmail -i [email protected]
From: Alex Blewitt <[email protected]>
To:
Cc: Alex Blewitt <[email protected]>
Subject: [PATCH 3/3] Don't allow others to instantiate NullProgressMonitor
Date: Wed, 6 May 2009 22:26:07 +0100
Message-Id: <[email protected]>
X-Mailer: git-send-email 1.6.2.2
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
Result: OK