* Re: can't push to ransom ssh port ?
From: Vaclav Hanzl @ 2008-07-04 13:35 UTC (permalink / raw)
To: pneshama; +Cc: git
In-Reply-To: <912ec82a0807040628k14c8acd1ree9d82b68f69e080@mail.gmail.com>
> Is there a way to tell git to connect to a random port X ?
>
> (something like ssh's -p parameter)
It can also be done using ~/.ssh/config with this:
Host a.b.c.d
Port 12345
(see man ssh_config), this way you just need to do it at one place for
ssh, scp and all git repositories.
Regards
Vaclav
^ permalink raw reply
* Re: can't push to ransom ssh port ?
From: Neshama Parhoti @ 2008-07-04 13:39 UTC (permalink / raw)
To: Denis Bueno, Johannes Schindelin; +Cc: git
In-Reply-To: <6dbd4d000807040633l6210e0cdtf37293ba44a52374@mail.gmail.com>
Thanks ! somehow I missed that..
^ permalink raw reply
* Re: can't push to ransom ssh port ?
From: Johannes Schindelin @ 2008-07-04 13:32 UTC (permalink / raw)
To: Neshama Parhoti; +Cc: git
In-Reply-To: <912ec82a0807040628k14c8acd1ree9d82b68f69e080@mail.gmail.com>
Hi,
On Fri, 4 Jul 2008, Neshama Parhoti wrote:
> Doing the following:
>
> git push myuser@myip:~/gitrepo
>
> Connects to ssh port 22 on myip.
>
> Is there a way to tell git to connect to a random port X ?
You could use a URL like "ssh://myuser@myip:X/home/myuser/gitrepo".
Hth,
Dscho
^ permalink raw reply
* Re: can't push to ransom ssh port ?
From: Denis Bueno @ 2008-07-04 13:33 UTC (permalink / raw)
To: Neshama Parhoti; +Cc: git
In-Reply-To: <912ec82a0807040628k14c8acd1ree9d82b68f69e080@mail.gmail.com>
On Fri, Jul 4, 2008 at 09:28, Neshama Parhoti <pneshama@gmail.com> wrote:
> Is there a way to tell git to connect to a random port X ?
>From the man page for git-push (git push --help):
One of the following notations can be used to name the remote repository:
....
o ssh://[user@]host.xz[:port]/path/to/repo.git/
--
Denis
^ permalink raw reply
* can't push to ransom ssh port ?
From: Neshama Parhoti @ 2008-07-04 13:28 UTC (permalink / raw)
To: git
Hi all,
Doing the following:
git push myuser@myip:~/gitrepo
Connects to ssh port 22 on myip.
Is there a way to tell git to connect to a random port X ?
(something like ssh's -p parameter)
I can't find how and I really need that..
Thank you!
pnesh
^ permalink raw reply
* Re: git push requires a subsequent git reset --hard ?
From: Neshama Parhoti @ 2008-07-04 13:25 UTC (permalink / raw)
To: Dmitry Potapov, peff; +Cc: Jakub Narebski, git
In-Reply-To: <20080702133606.GP5737@dpotapov.dyndns.org>
Thank you all for the replies !
I think git has one of the most supportive and friendly community !
^ permalink raw reply
* Re: [PATCH/v2] git-basis, a script to manage bases for git-bundle
From: Johannes Schindelin @ 2008-07-04 13:22 UTC (permalink / raw)
To: Mark Levedahl; +Cc: Adam Brewster, Junio C Hamano, git, Jakub Narebski
In-Reply-To: <486E2245.6040404@gmail.com>
Hi,
On Fri, 4 Jul 2008, Mark Levedahl wrote:
> I'm using this for sneaker-netting, so I know the bundles are being
> applied - clearly the create bundle and update in-tree basis steps could
> be separated, but I don't use this for cases where I'm not sure the
> bundle will be applied.
/me wonders if it would not make sense to support "git push <bundle>",
then. Maybe with a running counter, i.e.
$ git push the-bundle-5.bundle master
would create the-bundle-6.bundle with everything needed in addition to
the-bundle-5.bundle to have the current "master".
Just an idea,
Dscho
^ permalink raw reply
* Re: [PATCH/v2] git-basis, a script to manage bases for git-bundle
From: Mark Levedahl @ 2008-07-04 13:14 UTC (permalink / raw)
To: Adam Brewster; +Cc: Junio C Hamano, git, Jakub Narebski
In-Reply-To: <c376da900807031613pc63639du356946f8daeabb29@mail.gmail.com>
Adam Brewster wrote:
> Hi Mark,
>
> Thank you for your help, and I'm sorry I didn't get back to you sooner.
>
> That's a good way to do things. I tend to like my system better
> because it's a little more flexible and it doesn't pollute git-branch
> -a and gitk --all, also as I said before I like the bundle creation
> and the basis update to be separated.
>
> How do you deal with the case where you want to include remote refs in
> the bundle? Don't they get saved as
> refs/remotes/remote/remotes/somewhere-else/master?
>
> Adam
>
>
My script is based upon experience with breakage from keeping the basis
separate: absent keeping the refs in the git repo, there is nothing to
guarantee that the referenced commits continue to exist. We make
extensive use of short lived topic branches that are often rebased
multiple times before being incorporated into a stable branch, so an
externally stored basis would frequently have invalid commits. The
solutions to this are to 1) filter them out, one by one, with a "git
rev-parse $commit" or some such, or 2) keep the refs in tree so git will
not remove the objects.
I'm using this for sneaker-netting, so I know the bundles are being
applied - clearly the create bundle and update in-tree basis steps could
be separated, but I don't use this for cases where I'm not sure the
bundle will be applied. In the latter case, I just use a basis
containing only previous stable branches.
You are correct in the name for a remote in the pushed bundle, the names
do get convoluted, but then I'm not sure what the "correct" syntax would
be to refer to a remote repo's idea of a remote branch.
Mark
^ permalink raw reply
* Re: [PATCH 1/2] help.c: Add support for htmldir relative to git_exec_path()
From: Johannes Schindelin @ 2008-07-04 12:35 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Steffen Prohaska, Johannes Sixt, git
In-Reply-To: <7vk5g2uhi9.fsf@gitster.siamese.dyndns.org>
Hi,
On Fri, 4 Jul 2008, Junio C Hamano wrote:
> Could you check if there are copy-and-pasted duplicated code you can
> factor out before continuing this direction?
Note also that Hannes tried very hard to get rid of those ugly "#ifdef
__MINGW32__"s by declaring/overriding functions in git-compat-util.h.
I think that is such a good practice that we should not stop here.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH/RFC] Fix some warnings (on cygwin) to allow -Werror
From: Steffen Prohaska @ 2008-07-04 9:46 UTC (permalink / raw)
To: Ramsay Jones; +Cc: GIT Mailing-list, Junio C Hamano
In-Reply-To: <486CF5A9.5060104@ramsay1.demon.co.uk>
On Jul 3, 2008, at 5:52 PM, Ramsay Jones wrote:
>
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> ---
>
> Despite the subject line, this should be useful on any system for
> which uint32_t is defined to be unsigned long rather than
> unsigned int. (and where the return type of htonl() is similarly
> defined).
For MINGW, we fixed these warnings in the compat layer, see cd800eecc2:
diff --git a/compat/mingw.h b/compat/mingw.h
index a87cc96..6bc049a 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -186,6 +186,10 @@ pid_t mingw_spawnvpe(const char *cmd, const char
**argv, char **env);
void mingw_execvp(const char *cmd, char *const *argv);
#define execvp mingw_execvp
+static inline unsigned int git_ntohl(unsigned int x)
+{ return (unsigned int)ntohl(x); }
+#define ntohl git_ntohl
+
sig_handler_t mingw_signal(int sig, sig_handler_t handler);
#define signal mingw_signal
Steffen
^ permalink raw reply related
* Re: [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh)
From: Steffen Prohaska @ 2008-07-04 9:29 UTC (permalink / raw)
To: Junio C Hamano; +Cc: johannes.sixt, msysGit, git, Edward Z. Yang
In-Reply-To: <7vod5euhw3.fsf@gitster.siamese.dyndns.org>
On Jul 4, 2008, at 11:18 AM, Junio C Hamano wrote:
> Johannes Sixt <johannes.sixt@telecom.at> writes:
>
>> What about installing a wrapper script, plinkssh, that does this:
>>
>> #!/bin/bash
>>
>> if test "$1" = -p; then
>> port="-P $2"
>> shift; shift
>> fi
>>
>> exec plink $port "$@"
>>
>> and require plink users to set GIT_SSH=plinkssh?
>
> That's quite a nice solution with absolute minimum impact.
It has minimum impact on the source code of git. The same is not
true, however, for the git user and the installer on Windows:
- The proposed plinkssh requires that plink is in the PATH. This is
not necessarily the case on Windows. If plink is not in the PATH,
then the user needs to modify plinkssh.
- The msysgit installer supports setting GIT_SSH to the full path
of plink. It automatically detects this path based on Putty's
entries in the Windows registry. If we choose the plinkssh
solution the installer has to be modified.
Setting '-P' in connect.c would have some impact on the git source,
but would avoid changes elsewhere.
Steffen
^ permalink raw reply
* Re: [PATCH 1/2] help.c: Add support for htmldir relative to git_exec_path()
From: Junio C Hamano @ 2008-07-04 9:26 UTC (permalink / raw)
To: Steffen Prohaska; +Cc: Johannes Sixt, git
In-Reply-To: <1215162566-16062-1-git-send-email-prohaska@zib.de>
Steffen Prohaska <prohaska@zib.de> writes:
> If htmldir (in the Makefile) is a relative path, this path will be
> interpreted relative to git_exec_path. This can be used to create an
> installation that can be moved to a different directory without
> re-compiling. The Windows installer (msysgit) is an example for such
> a setup.
> ...
> + const char* html_path = GIT_HTML_PATH;
Style. Asterisk sticks to the variable, not type.
> + if (!is_absolute_path(html_path)) {
> + struct strbuf d = STRBUF_INIT;
> + strbuf_addf(&d, "%s/%s", git_exec_path(), html_path);
> + html_path = strbuf_detach(&d, NULL);
> + }
I've seen similar "if $this (which is usually an absolute) is relative, it
is taken as relative to git_exec_path" solution employed elsewhere in the
MinGW series, and I think it makes sense, even though initially I thought
it was somewhat hacky.
Could you check if there are copy-and-pasted duplicated code you can
factor out before continuing this direction? I suspect templates and
etc/gitconfig are specified in similar fashion, and it would probably be
easier to maintain if you define once:
char *system_path(const char *specified)
{
if (is_absolute_path(specified))
return specified;
... strbuf dance ...
return strbuf_detach(...);
}
and use it like this:
const char *html_path = system_path(GIT_HTML_PATH);
^ permalink raw reply
* Re: [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh)
From: Junio C Hamano @ 2008-07-04 9:18 UTC (permalink / raw)
To: johannes.sixt; +Cc: prohaska, msysGit, git, Edward Z. Yang
In-Reply-To: <200807022104.20146.johannes.sixt@telecom.at>
Johannes Sixt <johannes.sixt@telecom.at> writes:
> What about installing a wrapper script, plinkssh, that does this:
>
> #!/bin/bash
>
> if test "$1" = -p; then
> port="-P $2"
> shift; shift
> fi
>
> exec plink $port "$@"
>
> and require plink users to set GIT_SSH=plinkssh?
That's quite a nice solution with absolute minimum impact.
^ permalink raw reply
* Puzzled by gitk patch representation for merge commits
From: Jerome Lovy @ 2008-07-04 9:14 UTC (permalink / raw)
To: git
Hello,
I don't understand the graphical scheme that gitk uses when displaying
patches for merge commits. I would like to be able to explain this to
the people I'm trying to evangelize to git, because they are also
puzzled when they try to check with gitk what a merge has done to a
given file.
I can see that at least three graphical hints seem to be involved:
- font: regular/bold
- color: red/blue
(maybe there are more colors when the commit has more than two parents?)
- column for displaying the '+' or '-'
But I just don't see what is the respective semantics of these hints...
(I'm using git 1.5.5.1 if that matters.)
Thanks in advance,
Jérôme
^ permalink raw reply
* [PATCH 1/2] help.c: Add support for htmldir relative to git_exec_path()
From: Steffen Prohaska @ 2008-07-04 9:09 UTC (permalink / raw)
To: Junio C Hamano, Johannes Sixt; +Cc: git, Steffen Prohaska
In-Reply-To: <394A4A6F-3D31-4E38-A312-B49DE54FBBDD@zib.de>
If htmldir (in the Makefile) is a relative path, this path will be
interpreted relative to git_exec_path. This can be used to create an
installation that can be moved to a different directory without
re-compiling. The Windows installer (msysgit) is an example for such
a setup.
Note that the Makefile maps htmldir to the define GIT_HTML_PATH.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
help.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/help.c b/help.c
index ca9632b..5586e1d 100644
--- a/help.c
+++ b/help.c
@@ -634,12 +634,20 @@ static void get_html_page_path(struct strbuf *page_path, const char *page)
{
struct stat st;
+ const char* html_path = GIT_HTML_PATH;
+ if (!is_absolute_path(html_path)) {
+ struct strbuf d = STRBUF_INIT;
+ strbuf_addf(&d, "%s/%s", git_exec_path(), html_path);
+ html_path = strbuf_detach(&d, NULL);
+ }
+
/* Check that we have a git documentation directory. */
- if (stat(GIT_HTML_PATH "/git.html", &st) || !S_ISREG(st.st_mode))
- die("'%s': not a documentation directory.", GIT_HTML_PATH);
+ if (stat(mkpath("%s/git.html", html_path), &st)
+ || !S_ISREG(st.st_mode))
+ die("'%s': not a documentation directory.", html_path);
strbuf_init(page_path, 0);
- strbuf_addf(page_path, GIT_HTML_PATH "/%s.html", page);
+ strbuf_addf(page_path, "%s/%s.html", html_path, page);
}
static void show_html_page(const char *git_cmd)
--
1.5.6.1.282.gd8a0d
^ permalink raw reply related
* [PATCH 2/2] help (Windows): Display HTML in default browser using Win32 API
From: Steffen Prohaska @ 2008-07-04 9:09 UTC (permalink / raw)
To: Junio C Hamano, Johannes Sixt; +Cc: git, Steffen Prohaska
In-Reply-To: <1215162566-16062-1-git-send-email-prohaska@zib.de>
The Win32 API is now called directly to launch the system's default
browser for displaying HTML help pages instead of launching a shell to
execute git-web--browser. Avoiding the MSYS' bash when possible is good
because it avoids potential path translation issues. In this case it is
not too hard to avoid launching a shell, so let's avoid it.
This commit also adds make_native_separator() to convert slashes to
backslashes on Windows.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
cache.h | 2 ++
help.c | 18 ++++++++++++++++++
path.c | 18 ++++++++++++++++++
3 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/cache.h b/cache.h
index 35a9132..747581f 100644
--- a/cache.h
+++ b/cache.h
@@ -527,6 +527,8 @@ static inline int is_absolute_path(const char *path)
const char *make_absolute_path(const char *path);
const char *make_nonrelative_path(const char *path);
const char *make_relative_path(const char *abs, const char *base);
+/* Convert slashes to backslashes on Windows. no-op on other platforms. */
+const char *make_native_separator(const char *path);
/* Read and unpack a sha1 file into memory, write memory to a sha1 file */
extern int sha1_object_info(const unsigned char *, unsigned long *);
diff --git a/help.c b/help.c
index 5586e1d..8fcd644 100644
--- a/help.c
+++ b/help.c
@@ -9,6 +9,7 @@
#include "common-cmds.h"
#include "parse-options.h"
#include "run-command.h"
+#include "dir.h"
static struct man_viewer_list {
struct man_viewer_list *next;
@@ -650,6 +651,19 @@ static void get_html_page_path(struct strbuf *page_path, const char *page)
strbuf_addf(page_path, "%s/%s.html", html_path, page);
}
+#ifdef __MINGW32__
+static void open_html_win(const char *unixpath)
+{
+ const char *htmlpath = make_native_separator(mkpath("%s",unixpath));
+ if (!file_exists(htmlpath)) {
+ fprintf(stderr, "HTML file '%s' does not exist.\n", htmlpath);
+ exit(1);
+ }
+ printf("Launching default browser to display HTML help ...\n");
+ ShellExecute(NULL, "open", htmlpath, NULL, "\\", 0);
+}
+#endif
+
static void show_html_page(const char *git_cmd)
{
const char *page = cmd_to_page(git_cmd);
@@ -657,7 +671,11 @@ static void show_html_page(const char *git_cmd)
get_html_page_path(&page_path, page);
+#ifdef __MINGW32__
+ open_html_win(page_path.buf);
+#else
execl_git_cmd("web--browse", "-c", "help.browser", page_path.buf, NULL);
+#endif
}
void help_unknown_cmd(const char *cmd)
diff --git a/path.c b/path.c
index 496123c..9f2bd91 100644
--- a/path.c
+++ b/path.c
@@ -343,3 +343,21 @@ const char *make_relative_path(const char *abs, const char *base)
strcpy(buf, abs + baselen);
return buf;
}
+
+const char *make_native_separator(const char* path) {
+#ifdef __MINGW32__
+ static char buf[PATH_MAX + 1];
+ char* c;
+
+ if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)
+ die ("Too long path: %.*s", 60, path);
+
+ for (c = buf; *c; c++) {
+ if (*c == '/')
+ *c = '\\';
+ }
+ return buf;
+#else
+ return path;
+#endif
+}
--
1.5.6.1.282.gd8a0d
^ permalink raw reply related
* Re: [PATCH 05/12] Windows(msysgit): Per default, display help as HTML in default browser
From: Steffen Prohaska @ 2008-07-04 9:06 UTC (permalink / raw)
To: Johannes Sixt, Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <200807022057.47588.johannes.sixt@telecom.at>
On Jul 2, 2008, at 8:57 PM, Johannes Sixt wrote:
> On Mittwoch, 2. Juli 2008, Steffen Prohaska wrote:
>> The implementation directly calls the Win32 API to launch the
>> browser.
>> Note that the specific directory layout of msysgit is required.
>
>> +#ifdef __MINGW32__
>> + const char* exec_path = git_exec_path();
>> + char *htmlpath = make_native_separator(
>> + mkpath("%s/../doc/git/html/%s.html"
>> + , exec_path
>> + , git_cmd)
>> + );
>> + if (!file_exists(htmlpath)) {
>> + htmlpath = make_native_separator(
>> + mkpath("%s/../doc/git/html/git-%s.html"
>> + , exec_path
>> + , git_cmd)
>> + );
>> + if (!file_exists(htmlpath)) {
>> + fprintf(stderr, "Can't find HTML help for '%s'.\n"
>> + , git_cmd);
>> + exit(1);
>> + }
>> + }
>> + printf("Launching default browser to display HTML help ...\n");
>> + ShellExecute(NULL, "open", htmlpath, NULL, "\\", 0);
>> +#else
>
> Can't we move this part into git-web--browse.sh? It should be a
> matter of
> calling
>
> start $htmlpath
>
> (and msys-1.0.dll would convert slashes to backslashes for us).
I try to avoid the shell as much as possible on Windows.
How about the two following patches:
[PATCH 1/2] help.c: Add support for htmldir relative to
git_exec_path()
[PATCH 2/2] help (Windows): Display HTML in default browser using
Win32 API
I'll send them as replies to this mail.
Steffen
^ permalink raw reply
* Re: [PATCH/RFC] Fix some warnings (on cygwin) to allow -Werror
From: Junio C Hamano @ 2008-07-04 8:59 UTC (permalink / raw)
To: Ramsay Jones; +Cc: GIT Mailing-list
In-Reply-To: <486CF5A9.5060104@ramsay1.demon.co.uk>
Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:
> Despite the subject line, this should be useful on any system for
> which uint32_t is defined to be unsigned long rather than
> unsigned int. (and where the return type of htonl() is similarly
> defined).
Correct. Perhaps "Use %PRIu32 and such to print integers of fixed length"?
The only worry I have with this patch is with systems with not-so-ANSI
headers; as you noticed, we already have:
#ifndef PRIuMAX
#define PRIuMAX "llu"
#endif
in git-compat-util.h, which does include <inttypes.h>, so PRIu32 and
friends could be problematic on these platforms.
> @@ -1718,7 +1720,8 @@ static int add_ref_tag(const char *path, const unsigned char *sha1, int flag, vo
> static void prepare_pack(int window, int depth)
> {
> struct object_entry **delta_list;
> - uint32_t i, n, nr_deltas;
> + uint32_t i, nr_deltas;
> + unsigned n;
Hmm. Is this change necessary?
^ permalink raw reply
* Re: [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh)
From: Steffen Prohaska @ 2008-07-04 8:50 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Johannes Sixt, msysGit, git, Junio C Hamano, Edward Z. Yang
In-Reply-To: <alpine.DEB.1.00.0807031209440.9925@racer>
On Jul 3, 2008, at 1:10 PM, Johannes Schindelin wrote:
> On Wed, 2 Jul 2008, Johannes Sixt wrote:
>
>> On Mittwoch, 2. Juli 2008, Steffen Prohaska wrote:
>>> From: Edward Z. Yang <edwardzyang@thewritingpot.com>
>>>
>>> PuTTY requires -P while OpenSSH requires -p; if plink is detected
>>> as GIT_SSH, use the alternate flag.
>>>
>>> Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
>>> Signed-off-by: Steffen Prohaska <prohaska@zib.de>
>>> ---
>>> connect.c | 4 +++-
>>> 1 files changed, 3 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/connect.c b/connect.c
>>> index 574f42f..0d007f3 100644
>>> --- a/connect.c
>>> +++ b/connect.c
>>> @@ -599,11 +599,13 @@ struct child_process *git_connect(int fd[2],
>>> const
>>> char *url_orig, conn->argv = arg = xcalloc(6, sizeof(*arg));
>>> if (protocol == PROTO_SSH) {
>>> const char *ssh = getenv("GIT_SSH");
>>> + int putty = ssh && strstr(ssh, "plink");
>>> if (!ssh) ssh = "ssh";
>>>
>>> *arg++ = ssh;
>>> if (port) {
>>> - *arg++ = "-p";
>>> + /* P is for PuTTY, p is for OpenSSH */
>>> + *arg++ = putty ? "-P" : "-p";
>>> *arg++ = port;
>>> }
>>> *arg++ = host;
>>
>> What about installing a wrapper script, plinkssh, that does this:
>>
>> #!/bin/bash
>>
>> if test "$1" = -p; then
>> port="-P $2"
>> shift; shift
>> fi
>>
>> exec plink $port "$@"
>>
>> and require plink users to set GIT_SSH=plinkssh?
>
> I like that better than this special-casing of plink.
I'd prefer to change connect.c. plinkssh would introduce another
dependency on the shell, while our overall goal is to avoid shell as
much as possible on Windows, no? Edward's solution also looks more
obvious to me than the plinkssh wrapper script.
Steffen
^ permalink raw reply
* Re: [OT] Your branch is ahead of the tracked remote branch 'origin/master' by 50 commits.
From: Pedro Melo @ 2008-07-04 8:35 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Git Mailing List
In-Reply-To: <20080701112235.GC11809@elte.hu>
Hi,
On Jul 1, 2008, at 12:22 PM, Ingo Molnar wrote:
> [ Oh, and i could switch between git versions without having to
> rebuild
> ;-) ]
hmms... Can you just use
version=`git-describe`
./configure --prefix=/usr/local/git-$version
make && sudo make install
sudo sh -c 'rm -f /usr/local/git && ln -s /usr/local/git-$version /
usr/local/git'
and stick /usr/local/git/bin in your path?
Changing git versions is just a ln -s away.
Best regards,
--
Pedro Melo
Blog: http://www.simplicidade.org/notes/
XMPP ID: melo@simplicidade.org
Use XMPP!
^ permalink raw reply
* Re: [StGit PATCH 2/2] Implement "stg refresh --edit" again
From: Jakub Narebski @ 2008-07-04 7:32 UTC (permalink / raw)
To: Karl Hasselström; +Cc: Catalin Marinas, git
In-Reply-To: <20080704064036.9637.52951.stgit@yoghurt>
Karl Hasselström napisał:
> The -e/--edit flag to "stg refresh" was dropped between v0.13 and
> v0.14, causing severe user dissatisfaction. This patch restores it
Thanks a lot!
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: finding deleted file names
From: Junio C Hamano @ 2008-07-04 7:05 UTC (permalink / raw)
To: geoffrey.russell; +Cc: Jeff King, Mikael Magnusson, git
In-Reply-To: <93c3eada0807032345r2ff59d69kca42bc9ea7782f31@mail.gmail.com>
"Geoff Russell" <geoffrey.russell@gmail.com> writes:
> ... I've made a bunch of changes to a repository, a few weeks later I
> figure I've deleted a file I need but am not really sure of its name. So
> I want to list the files that I've deleted during the past few weeks.
$ git log --pretty=oneline --diff-filter=D --name-only -M --since=90.days
^ permalink raw reply
* Re: finding deleted file names
From: Geoff Russell @ 2008-07-04 6:45 UTC (permalink / raw)
To: Jeff King; +Cc: Mikael Magnusson, git
In-Reply-To: <20080703104233.GA26162@sigill.intra.peff.net>
On 7/3/08, Jeff King <peff@peff.net> wrote:
> On Thu, Jul 03, 2008 at 12:15:37PM +0930, Geoff Russell wrote:
>
> > >> Is there something that says "since repository creation", ie., go back as far
> > >> as possible, but no further? Is there a symbolic name for the initial commit?
> > >
> > > There's no symbolic name for it, since there might not be only one initial
> > > commit. git.git for example has at least three root commits. You will
> > > probably get what you want with $(git rev-list HEAD|tail -1). If your
> > > history is very large, $(git rev-list --reverse HEAD|head -1) is slightly
> > > faster, but usually not enough to offset typing --reverse :).
> >
> > Thanks for this, but I'm a little confused.
> >
> > If I do a "git init", there must be a first commit after this? Isn't
> > this the first commit, how
> > can there be more than one first commit?
>
>
> The confusing part is that you two are talking about two slightly
> different things. If you define "initial commit" as "the commit which
> has no parents" then there can be many (you get a new one anytime you
> merge in a project with unrelated history).
>
> However, what Geoff originally mentioned was HEAD{'7 days ago'}, which
> actually looks in the reflog. So if you define "initial commit" as "the
> first commit value that this ref ever had" then there is only one
> (though of course, your reflog will eventually expire, so it won't be
> "the oldest value this ref ever had" but rather "the oldest one the
> reflog ever remembers it having").
You guys are (quite properly) worried about all the edge cases and I
have probably
confused things by using the reflog when they may be a better way of
doing things.
Perhaps if I describe the problem, there may be a better solution than using the
reflog. I've made a bunch of changes to a repository, a few weeks
later I figure I've
deleted a file I need but am not really sure of its name. So I want to list the
files that I've deleted during the past few weeks. So the aim is to
find the files that
aren't in the current working directory but that are in some commit done since
day X.
Cheers,
Geoff
>
> -Peff
>
--
6 Fifth Ave,
St Morris, S.A. 5068
Australia
Ph: 041 8805 184 / 08 8332 5069
^ permalink raw reply
* [PATCH] t4127-apply-same-fn: Avoid sed -i
From: Johannes Sixt @ 2008-07-04 6:43 UTC (permalink / raw)
To: Don Zickus; +Cc: git, Junio C Hamano
In-Reply-To: <1215100820-23140-1-git-send-email-dzickus@redhat.com>
From: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
---
Don Zickus schrieb:
> When I created the tests for my git-apply patch, I accidently used the '-i'
> flag for sed. Not all versions of sed handle this flag, so I converted
> those instances to output to a temp file and move that temp file back to the
> original file.
I had this alternate patch in my tree, but forgot to submit it.
-- Hannes
t/t4127-apply-same-fn.sh | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/t/t4127-apply-same-fn.sh b/t/t4127-apply-same-fn.sh
index 2a6ed77..1f859dd 100755
--- a/t/t4127-apply-same-fn.sh
+++ b/t/t4127-apply-same-fn.sh
@@ -4,6 +4,11 @@ test_description='apply same filename'
. ./test-lib.sh
+modify () {
+ sed -e "$1" < "$2" > "$2".x &&
+ mv "$2".x "$2"
+}
+
test_expect_success setup '
for i in a b c d e f g h i j k l m
do
@@ -14,10 +19,10 @@ test_expect_success setup '
git commit -m initial
'
test_expect_success 'apply same filename with independent changes' '
- sed -i -e "s/^d/z/" same_fn &&
+ modify "s/^d/z/" same_fn &&
git diff > patch0 &&
git add same_fn &&
- sed -i -e "s/^i/y/" same_fn &&
+ modify "s/^i/y/" same_fn &&
git diff >> patch0 &&
cp same_fn same_fn2 &&
git reset --hard &&
@@ -27,10 +32,10 @@ test_expect_success 'apply same filename with independent changes' '
test_expect_success 'apply same filename with overlapping changes' '
git reset --hard
- sed -i -e "s/^d/z/" same_fn &&
+ modify "s/^d/z/" same_fn &&
git diff > patch0 &&
git add same_fn &&
- sed -i -e "s/^e/y/" same_fn &&
+ modify "s/^e/y/" same_fn &&
git diff >> patch0 &&
cp same_fn same_fn2 &&
git reset --hard &&
@@ -41,10 +46,10 @@ test_expect_success 'apply same filename with overlapping changes' '
test_expect_success 'apply same new filename after rename' '
git reset --hard
git mv same_fn new_fn
- sed -i -e "s/^d/z/" new_fn &&
+ modify "s/^d/z/" new_fn &&
git add new_fn &&
git diff -M --cached > patch1 &&
- sed -i -e "s/^e/y/" new_fn &&
+ modify "s/^e/y/" new_fn &&
git diff >> patch1 &&
cp new_fn new_fn2 &&
git reset --hard &&
@@ -55,11 +60,11 @@ test_expect_success 'apply same new filename after rename' '
test_expect_success 'apply same old filename after rename -- should fail.' '
git reset --hard
git mv same_fn new_fn
- sed -i -e "s/^d/z/" new_fn &&
+ modify "s/^d/z/" new_fn &&
git add new_fn &&
git diff -M --cached > patch1 &&
git mv new_fn same_fn
- sed -i -e "s/^e/y/" same_fn &&
+ modify "s/^e/y/" same_fn &&
git diff >> patch1 &&
git reset --hard &&
test_must_fail git apply patch1
@@ -68,15 +73,15 @@ test_expect_success 'apply same old filename after rename -- should fail.' '
test_expect_success 'apply A->B (rename), C->A (rename), A->A -- should pass.' '
git reset --hard
git mv same_fn new_fn
- sed -i -e "s/^d/z/" new_fn &&
+ modify "s/^d/z/" new_fn &&
git add new_fn &&
git diff -M --cached > patch1 &&
git commit -m "a rename" &&
git mv other_fn same_fn
- sed -i -e "s/^e/y/" same_fn &&
+ modify "s/^e/y/" same_fn &&
git add same_fn &&
git diff -M --cached >> patch1 &&
- sed -i -e "s/^g/x/" same_fn &&
+ modify "s/^g/x/" same_fn &&
git diff >> patch1 &&
git reset --hard HEAD^ &&
git apply patch1
--
1.5.6.1.1099.ge791.dirty
^ permalink raw reply related
* [StGit PATCH 2/2] Implement "stg refresh --edit" again
From: Karl Hasselström @ 2008-07-04 6:40 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git, Jakub Narebski
In-Reply-To: <20080704063755.9637.23750.stgit@yoghurt>
The -e/--edit flag to "stg refresh" was dropped between v0.13 and
v0.14, causing severe user dissatisfaction. This patch restores it,
along with -m/--message, -f/--file, --sign, --ack, --author,
--authname, --authemail, and --authdate.
I omitted the --committer options on purpose; I think they are a
mistake. Falsifying the committer info is not a common operation, and
if one wishes to do it for some reason, one can always set the
GIT_COMMITTER_* environment variables.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/commands/coalesce.py | 2 +-
stgit/commands/edit.py | 3 ++-
stgit/commands/new.py | 3 ++-
stgit/commands/refresh.py | 44 +++++++++++++++++++++++++++++++++-----------
stgit/utils.py | 18 ++++++++++++------
5 files changed, 50 insertions(+), 20 deletions(-)
diff --git a/stgit/commands/coalesce.py b/stgit/commands/coalesce.py
index 1a34934..f3954ce 100644
--- a/stgit/commands/coalesce.py
+++ b/stgit/commands/coalesce.py
@@ -35,7 +35,7 @@ done a sequence of pushes and pops yourself."""
directory = common.DirectoryHasRepositoryLib()
options = [make_option('-n', '--name', help = 'name of coalesced patch')
- ] + utils.make_message_options()
+ ] + utils.make_message_options(save_template = True)
class SaveTemplateDone(Exception):
pass
diff --git a/stgit/commands/edit.py b/stgit/commands/edit.py
index a9e8991..a83ec9c 100644
--- a/stgit/commands/edit.py
+++ b/stgit/commands/edit.py
@@ -60,7 +60,8 @@ options = [make_option('-d', '--diff',
action = 'store_true'),
make_option('-e', '--edit', action = 'store_true',
help = 'invoke interactive editor'),
- ] + (utils.make_sign_options() + utils.make_message_options()
+ ] + (utils.make_sign_options()
+ + utils.make_message_options(save_template = True)
+ utils.make_author_committer_options()
+ utils.make_diff_opts_option())
diff --git a/stgit/commands/new.py b/stgit/commands/new.py
index c4ee4e1..f468ab0 100644
--- a/stgit/commands/new.py
+++ b/stgit/commands/new.py
@@ -38,7 +38,8 @@ line of the commit message."""
directory = common.DirectoryHasRepositoryLib()
options = (utils.make_author_committer_options()
- + utils.make_message_options() + utils.make_sign_options())
+ + utils.make_message_options(save_template = True)
+ + utils.make_sign_options())
def func(parser, options, args):
"""Create a new patch."""
diff --git a/stgit/commands/refresh.py b/stgit/commands/refresh.py
index 7afc55e..37cb559 100644
--- a/stgit/commands/refresh.py
+++ b/stgit/commands/refresh.py
@@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from optparse import make_option
from stgit.commands import common
-from stgit.lib import git, transaction
+from stgit.lib import git, transaction, edit
from stgit import utils
help = 'generate a new commit for the current patch'
@@ -53,7 +53,11 @@ options = [make_option('-u', '--update', action = 'store_true',
help = ('only include changes from the index, not'
' from the work tree')),
make_option('-p', '--patch',
- help = 'refresh PATCH instead of the topmost patch')]
+ help = 'refresh PATCH instead of the topmost patch'),
+ make_option('-e', '--edit', action = 'store_true',
+ help = 'invoke an editor for the patch description')
+ ] + (utils.make_message_options(save_template = False)
+ + utils.make_sign_options() + utils.make_author_options())
def get_patch(stack, given_patch):
"""Get the name of the patch we are to refresh."""
@@ -116,9 +120,12 @@ def make_temp_patch(stack, patch_name, paths, temp_index):
return trans.run(stack.repository.default_iw,
print_current_patch = False), temp_name
-def absorb_applied(trans, iw, patch_name, temp_name):
+def absorb_applied(trans, iw, patch_name, temp_name, edit_fun):
"""Absorb the temp patch (C{temp_name}) into the given patch
- (C{patch_name}), which must be applied.
+ (C{patch_name}), which must be applied. If the absorption
+ succeeds, call C{edit_fun} on the resulting
+ L{CommitData<stgit.lib.git.CommitData>} before committing it and
+ commit the return value.
@return: C{True} if we managed to absorb the temp patch, C{False}
if we had to leave it for the user to deal with."""
@@ -136,7 +143,7 @@ def absorb_applied(trans, iw, patch_name, temp_name):
temp_cd = trans.patches[temp_name].data
assert trans.patches[patch_name] == temp_cd.parent
trans.patches[patch_name] = trans.stack.repository.commit(
- trans.patches[patch_name].data.set_tree(temp_cd.tree))
+ edit_fun(trans.patches[patch_name].data.set_tree(temp_cd.tree)))
popped = trans.delete_patches(lambda pn: pn == temp_name, quiet = True)
assert not popped # the temp patch was topmost
temp_absorbed = True
@@ -148,9 +155,12 @@ def absorb_applied(trans, iw, patch_name, temp_name):
pass
return temp_absorbed
-def absorb_unapplied(trans, iw, patch_name, temp_name):
+def absorb_unapplied(trans, iw, patch_name, temp_name, edit_fun):
"""Absorb the temp patch (C{temp_name}) into the given patch
- (C{patch_name}), which must be unapplied.
+ (C{patch_name}), which must be unapplied. If the absorption
+ succeeds, call C{edit_fun} on the resulting
+ L{CommitData<stgit.lib.git.CommitData>} before committing it and
+ commit the return value.
@param iw: Not used.
@return: C{True} if we managed to absorb the temp patch, C{False}
@@ -174,7 +184,7 @@ def absorb_unapplied(trans, iw, patch_name, temp_name):
# It worked. Refresh the patch with the new tree, and delete
# the temp patch.
trans.patches[patch_name] = trans.stack.repository.commit(
- patch_cd.set_tree(new_tree))
+ edit_fun(patch_cd.set_tree(new_tree)))
popped = trans.delete_patches(lambda pn: pn == temp_name, quiet = True)
assert not popped # the temp patch was not applied
return True
@@ -183,13 +193,13 @@ def absorb_unapplied(trans, iw, patch_name, temp_name):
# leave the temp patch for the user.
return False
-def absorb(stack, patch_name, temp_name):
+def absorb(stack, patch_name, temp_name, edit_fun):
"""Absorb the temp patch into the target patch."""
trans = transaction.StackTransaction(stack, 'refresh')
iw = stack.repository.default_iw
f = { True: absorb_applied, False: absorb_unapplied
}[patch_name in trans.applied]
- if f(trans, iw, patch_name, temp_name):
+ if f(trans, iw, patch_name, temp_name, edit_fun):
def info_msg(): pass
else:
def info_msg():
@@ -223,4 +233,16 @@ def func(parser, options, args):
stack, patch_name, paths, temp_index = path_limiting)
if retval != utils.STGIT_SUCCESS:
return retval
- return absorb(stack, patch_name, temp_name)
+ def edit_fun(cd):
+ cd, failed_diff = edit.auto_edit_patch(
+ stack.repository, cd, msg = options.message, contains_diff = False,
+ author = options.author, committer = lambda p: p,
+ sign_str = options.sign_str)
+ assert not failed_diff
+ if options.edit:
+ cd, failed_diff = edit.interactive_edit_patch(
+ stack.repository, cd, edit_diff = False,
+ diff_flags = [], replacement_diff = None)
+ assert not failed_diff
+ return cd
+ return absorb(stack, patch_name, temp_name, edit_fun)
diff --git a/stgit/utils.py b/stgit/utils.py
index 2983ea8..c40e666 100644
--- a/stgit/utils.py
+++ b/stgit/utils.py
@@ -264,13 +264,13 @@ def add_sign_line(desc, sign_str, name, email):
desc = desc + '\n'
return '%s\n%s\n' % (desc, sign_str)
-def make_message_options():
+def make_message_options(save_template):
def no_dup(parser):
if parser.values.message != None:
raise optparse.OptionValueError(
'Cannot give more than one --message or --file')
def no_combine(parser):
- if (parser.values.message != None
+ if (save_template and parser.values.message != None
and parser.values.save_template != None):
raise optparse.OptionValueError(
'Cannot give both --message/--file and --save-template')
@@ -299,15 +299,18 @@ def make_message_options():
parser.values.save_template = w
no_combine(parser)
m = optparse.make_option
- return [m('-m', '--message', action = 'callback', callback = msg_callback,
+ opts = [m('-m', '--message', action = 'callback', callback = msg_callback,
dest = 'message', type = 'string',
help = 'use MESSAGE instead of invoking the editor'),
m('-f', '--file', action = 'callback', callback = file_callback,
dest = 'message', type = 'string', metavar = 'FILE',
- help = 'use FILE instead of invoking the editor'),
+ help = 'use FILE instead of invoking the editor')]
+ if save_template:
+ opts.append(
m('--save-template', action = 'callback', callback = templ_callback,
metavar = 'FILE', dest = 'save_template', type = 'string',
- help = 'save the message template to FILE and exit')]
+ help = 'save the message template to FILE and exit'))
+ return opts
def make_diff_opts_option():
def diff_opts_callback(option, opt_str, value, parser):
@@ -368,8 +371,11 @@ def make_person_options(person, short):
callback_args = (f,), help = 'set the %s %s' % (person, f))
for f in ['name', 'email', 'date']])
+def make_author_options():
+ return make_person_options('author', 'auth')
+
def make_author_committer_options():
- return (make_person_options('author', 'auth')
+ return (make_author_options()
+ make_person_options('committer', 'comm'))
# Exit codes.
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox