Fossil

Check-in [01231dcb]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:When importing a git fast-import, we silently change master branch to trunk to match the default fossil naming conventions. So when we export to the git fast-import format, we should silently change the trunk branch back into master to match the git naming conventions.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | roy-export
Files: files | file ages | folders
SHA1:01231dcb5e1bec7125c0211159bd0370e383bdbe
User & Date: roy.marples 2017-02-10 01:44:45
Context
2017-02-10
13:03
Style check-in: 8e707973 user: roy.marples tags: roy-export
01:44
When importing a git fast-import, we silently change master branch to trunk to match the default fossil naming conventions. So when we export to the git fast-import format, we should silently change the trunk branch back into master to match the git naming conventions. check-in: 01231dcb user: roy.marples tags: roy-export
01:25
Add function print_ref to sanitize branch and tag names in accordance with https://git-scm.com/docs/git-check-ref-format

Use this rather than simply replacing non alpha or numeric chars for branch and tag names when exporting. check-in: abc87ccd user: roy.marples tags: roy-export

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/export.c.

609
610
611
612
613
614
615
616

617
618
619
620
621
622
623
    const char *zBranch = db_column_text(&q, 4);
    char *zMark;

    bag_insert(&vers, ckinId);
    db_bind_int(&q2, ":rid", ckinId);
    db_step(&q2);
    db_reset(&q2);
    if( zBranch==0 ) zBranch = "trunk";

    zMark = mark_name_from_rid(ckinId, &unused_mark);
    printf("commit refs/heads/");
    print_ref(zBranch);
    printf("\nmark %s\n", zMark);
    free(zMark);
    printf("committer");
    print_person(zUser);







|
>







609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
    const char *zBranch = db_column_text(&q, 4);
    char *zMark;

    bag_insert(&vers, ckinId);
    db_bind_int(&q2, ":rid", ckinId);
    db_step(&q2);
    db_reset(&q2);
    /* fossil trunk is git master. */
    if( zBranch==0 || fossil_strcmp(zBranch, "trunk") == 0 ) zBranch = "master";
    zMark = mark_name_from_rid(ckinId, &unused_mark);
    printf("commit refs/heads/");
    print_ref(zBranch);
    printf("\nmark %s\n", zMark);
    free(zMark);
    printf("committer");
    print_person(zUser);