gitbook-summary icon indicating copy to clipboard operation
gitbook-summary copied to clipboard

book sm orders differently if .git folder is not present

Open diginc opened this issue 8 years ago • 1 comments

I have book.json with "sortedBy": "_", and several folders setup like:

2_Top
└── README.md
3_Mid
└── README.md
4_Mid2
└── README.md
5_Mid3
└── README.md
9_Last
├── 2_Top
│   └── README.md
├── 3_Mid
│   └── README.md
├── 9_Last
│   └── 3_Mid
│       └── README.md
└── README.md

My production deployment downloaded github's master.zip download link (e.g. like this link, but for my private repo), which doesn't have the .git folder in it, and ran book sm before starting gitbook serve. I noticed the ordering was not being obeyed the same as when the .git folder is present...any ideas why?

Here is an example SUMMARY.md output based off the above directory structure. The problem only presents itself when nesting data in the last sorted directory...

SUMMARY.md before git init of a repo:

- [Top](2_Top/README.md)
- [Mid 2](4_Mid2/README.md)
- [Mid 3](5_Mid3/README.md)
- [Last](9_Last/README.md)
  - [Top](9_Last/2_Top/README.md)
  - [Mid](9_Last/3_Mid/README.md)
  - Last
    - [Mid](9_Last/9_Last/3_Mid/README.md)
- [Mid](3_Mid/README.md)

after git init and add/commiting all the files...book sm results in:

- [Top](2_Top/README.md)
- [Mid](3_Mid/README.md)
- [Mid 2](4_Mid2/README.md)
- [Mid 3](5_Mid3/README.md)
- [Last](9_Last/README.md)
  - [Top](9_Last/2_Top/README.md)
  - [Mid](9_Last/3_Mid/README.md)
  - Last
    - [Mid](9_Last/9_Last/3_Mid/README.md)

I've worked around the issue by swithcing to a git clone --depth 1 so I have .git data...but I thought it was an odd bug worth reporting still.

diginc avatar Dec 05 '16 17:12 diginc

Hi,

It`s maybe a bug. :cry:

.git should have been ignore https://github.com/imfly/gitbook-summary/blob/master/lib/summary/index.js#L138

imfly avatar Dec 06 '16 14:12 imfly