[Xcb] Git usage question
Barton C Massey
bart at cs.pdx.edu
Sat Oct 4 16:28:04 PDT 2008
In message <200810031243.11880.doomster at knuut.de> you wrote:
> I'm looking at http://xcb.freedesktop.org/DevelopersGuide/, and there's
> something missing: an example. What I have in mind is something that shows a
> prospective patch-submitter how to get the sources, make a change and submit
> a patch to the mailinglist.
>
> I just did approximately this:
>
> git clone git://anongit.freedesktop.org/git/xcb/util
> cd util
> git branch --track -l example-branch
> $(EDITOR) <files>
> git commit -a
> git log -p -1 > ../example.patch
>
> which would serve as example.
Thanks much for getting going with git!
You really don't need to branch the repo. Although it's OK
to do so, it makes it a bit less convenient to automatically
merge upstream commits while working on your patches. Git
is quite good at managing keeping an external repo synced
with you without wrecking your work. :-)
You might want to format your patch with "git format-patch
HEAD^". By default, this creates a reasonably named patch
file in the current directory that you can just attach. If
you specify more than one commit, you'll get more than one
patch file. The only real substantive format difference
between the "format-patch" format and the "git log -p"
format is that format-patch attaches the git version number
to the patch; this is a feature, though.
> The resulting patch is below, btw. Does that
> look good? Should I have attached it rather? Any other suggestions?
Attaching it would be slightly better, assuming you can
attach it as some textual type rather than mime-encoded.
The latter is no good, as then some folks can't read it so
easily from their mailer.
If you wanted to document all this on the X.Org wiki and
stick a pointer to the doc on the XCB wiki, that would be
really nice.
As to the patch content, I think it depends. :-) The casts
that you are removing are mostly from habit, but they are
AFAIK harmless, and are required for some pre-ANSI C
compilers. I'd probably just leave them alone, were it me.
Is there something I'm missing? What do others think?
Again, thanks.
Bart
> commit 7e11f6af2d597ac208813fe0f4b65868f2ee0945
> Author: Ulrich Eckhardt <doomster at knuut.de>
> Date: Fri Oct 3 11:34:43 2008 +0200
>
> Do not cast the returnvalue of malloc() in C.
>
> diff --git a/image/xcb_image.c b/image/xcb_image.c
> index 2388948..701dda4 100644
> --- a/image/xcb_image.c
> +++ b/image/xcb_image.c
> @@ -227,7 +227,7 @@ xcb_image_create (uint16_t width,
> }
> if (!format_valid(depth, bpp, unit, format, xpad))
> return 0;
> - image = (xcb_image_t *)malloc(sizeof(*image));
> + image = malloc(sizeof(*image));
> if (image == 0)
> return 0;
> image->width = width;
> diff --git a/keysyms/keysyms.c b/keysyms/keysyms.c
> index 83c1d3d..4f432d1 100644
> --- a/keysyms/keysyms.c
> +++ b/keysyms/keysyms.c
> @@ -49,7 +49,7 @@ xcb_key_symbols_alloc (xcb_connection_t *c)
> if (!c)
> return NULL;
>
> - syms = (xcb_key_symbols_t *)malloc (sizeof (xcb_key_symbols_t));
> + syms = malloc (sizeof (xcb_key_symbols_t));
>
> syms->c = c;
> syms->tag = TAG_COOKIE;
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb
More information about the Xcb
mailing list